nbb

mkvlr 2023-03-30T08:20:47.934179Z

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?

borkdude 2023-03-30T08:32:36.902679Z

only programmatic or via nbb repl / nrepl-server etc

mkvlr 2023-03-30T08:46:53.322769Z

but nbb nrepl-server doesnโ€™t compose with -m , correct?

borkdude 2023-03-30T08:48:06.021059Z

correct

borkdude 2023-03-30T08:49:06.376889Z

nrepl-server does support an initial expression that you can execute, so you can compose that way

borkdude 2023-03-30T08:52:08.195709Z

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

mkvlr 2023-03-30T08:52:36.879359Z

can I compose this with a -main fn?

borkdude 2023-03-30T08:53:45.276229Z

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

borkdude 2023-03-30T08:54:46.600979Z

but you may as well just start the nrepl server in your main entry point

mkvlr 2023-03-30T08:55:40.692409Z

yeah, the main entry point is my test runner in that case

mkvlr 2023-03-30T08:56:05.618789Z

donโ€™t want to complect it with the repl concerns

borkdude 2023-03-30T08:56:11.237599Z

but your test runner also has an API function, so you could programmatically start your test runner?

borkdude 2023-03-30T08:56:40.611739Z

your test runner could also support an :init expression

borkdude 2023-03-30T08:56:51.375619Z

too many choices ;)

borkdude 2023-03-30T08:57:22.640979Z

I think programmatically using your test runner is the most flexible / composable option

๐Ÿ‘ 1
mkvlr 2023-03-30T08:57:38.553889Z

since itโ€™s not mine, not sure I want to change the api ๐Ÿ™ƒ

borkdude 2023-03-30T08:57:39.605099Z

let the user compose what they want, instead of guessing what the user might want to compose beforehand

borkdude 2023-03-30T08:58:28.652709Z

@mkvlr I have a fork of the cognitect test runner with some additional niceties.

borkdude 2023-03-30T08:59:01.542849Z

or not a fork, but a "wrapper": https://github.com/babashka/cli/blob/main/test/babashka/test_runner.clj

๐Ÿ‘€ 1
borkdude 2023-03-30T08:59:22.427259Z

it supports :only for invoking a namespace or var, similar to what lein has

borkdude 2023-03-30T08:59:34.139829Z

also it prints that command when a test fails, so you can easily copy/paste it

borkdude 2023-03-30T08:59:41.483899Z

and it prints what test it's running

borkdude 2023-03-30T08:59:46.424979Z

basically all my favorite things from lein

borkdude 2023-03-30T09:00:26.261159Z

I see I don't have the printing of the test in there, but it's what I do usually in user space

borkdude 2023-03-30T09:03:45.874259Z

@mkvlr What was your idea btw? The test runner runs the tests AND you have REPL, but then?

mkvlr 2023-03-30T09:05:04.982279Z

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

mkvlr 2023-03-30T09:05:25.579009Z

but yeah, a separate entry point is probably the way to go for this use case

๐Ÿ‘ 1