Fork me on GitHub
#tools-deps
<
2020-05-27
>
respatialized13:05:05

Is there a way using deps.edn to add code that gets eval'd on startup for an alias or for a repl launched using clj? The problem I'm specifically trying to solve is requiring jansi-clj for any terminal clojure session so it picks up my system terminal colors, but I was wondering if there was a generally recommended approach to the problem of "default startup code" using tools-deps.

alexmiller13:05:57

you can use clojure.main's -i or -e sometimes for things likee this

alexmiller13:05:09

clj -h will tell you more

alexmiller13:05:27

-i loads an arbitrary clj file, -e runs an expression

respatialized13:05:02

got it, so it's the simple matter of combining -e (require 'jansi-clj.auto) -r to launch a repl with some short startup code, and -i "/path/to/file" -r for anything longer. thanks!

alexmiller13:05:02

yep, and you can put that in an alias with :main-opts

alexmiller13:05:22

so clj -A:repl or whatever