tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
respatialized 2020-05-27T13:17:05.155300Z

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.

alexmiller 2020-05-27T13:18:57.156Z

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

alexmiller 2020-05-27T13:19:09.156200Z

clj -h will tell you more

alexmiller 2020-05-27T13:19:27.156600Z

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

respatialized 2020-05-27T13:22:02.158400Z

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!

alexmiller 2020-05-27T13:23:02.158900Z

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

alexmiller 2020-05-27T13:23:22.159200Z

so clj -A:repl or whatever