Fork me on GitHub

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.

Alex Miller (Clojure team)13:05:57

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

Alex Miller (Clojure team)13:05:09

clj -h will tell you more

Alex Miller (Clojure team)13:05:27

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


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

Alex Miller (Clojure team)13:05:02

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

Alex Miller (Clojure team)13:05:22

so clj -A:repl or whatever