if I want to conditionally start a repl, is there non-programmatic ways to do this (like for socket repl on the JVM using a system prop) or do I need to do this as part of my entry point?
only programmatic or via nbb repl / nrepl-server etc
but nbb nrepl-server doesnโt compose with -m , correct?
correct
nrepl-server does support an initial expression that you can execute, so you can compose that way
I thought it was also implemented for nrepl, but it looks like it's only there fore the console REPL: https://github.com/babashka/nbb/commit/6a1ff769df2afe0e642a57de9dda31145f722313 But it could be done for nrepl as well
can I compose this with a -main fn?
what I mean is: you can programmatically start an nREPL server and do an :init expression in there, and e.g. execute a function that you would otherwise have executed with -m
but you may as well just start the nrepl server in your main entry point
yeah, the main entry point is my test runner in that case
donโt want to complect it with the repl concerns
but your test runner also has an API function, so you could programmatically start your test runner?
your test runner could also support an :init expression
too many choices ;)
I think programmatically using your test runner is the most flexible / composable option
since itโs not mine, not sure I want to change the api ๐
let the user compose what they want, instead of guessing what the user might want to compose beforehand
@mkvlr I have a fork of the cognitect test runner with some additional niceties.
or not a fork, but a "wrapper": https://github.com/babashka/cli/blob/main/test/babashka/test_runner.clj
it supports :only for invoking a namespace or var, similar to what lein has
also it prints that command when a test fails, so you can easily copy/paste it
and it prints what test it's running
basically all my favorite things from lein
I see I don't have the printing of the test in there, but it's what I do usually in user space
@mkvlr What was your idea btw? The test runner runs the tests AND you have REPL, but then?
yeah so have it start a repl when running in dev and exit on failure but pause and support to take over with interactive dev
but yeah, a separate entry point is probably the way to go for this use case