babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
NoahTheDuke 2020-11-08T00:50:39.223600Z

any reason for a .babashka folder and not just the equivalent of a .babashka_rc file?

borkdude 2020-11-08T07:56:12.224200Z

This is for projects, not a global thing

borkdude 2020-11-08T10:31:39.224800Z

I made a babashka survey: https://nl.surveymonkey.com/r/H2HK3RC Please fill it out if you have feedback for babashka!

holmdunc 2020-11-08T18:12:06.225700Z

I put set -e at the top of a lot of my Bash scripts, so that all child processes that are synchronously run get implicitly checked for non-zero exit status. I'm wondering how I can get the same experience with Babashka. Maybe write a macro ($$ ...) that's like babashka.process/$ but also adds an implicit (check ...) ?

borkdude 2020-11-08T18:16:00.226Z

yes, you could do that (or just a function)

borkdude 2020-11-08T18:20:11.226800Z

user=> (defmacro $$ [& args] `(p/check (p/$ ~@args)))
#'user/$$
user=> (-> ($$ ls -la) :out slurp)
...
user=> (-> ($$ ls foo) :out slurp)
ls: foo: No such file or directory

holmdunc 2020-11-08T18:24:49.227900Z

Yeah that's pretty cool. I guess ^{:inherit true} on the ($ ...) too for the full experience?

holmdunc 2020-11-08T18:26:13.228200Z

Do you have the sense that many users write (or want to write) a bunch of straight-line code like (process ...)\n(process ...)\n(process ...) or ($ ...)\n($ ...)\n($ ...) ?

borkdude 2020-11-08T18:28:26.229Z

If you don't need the output in your script, but you just want to do a side effect, then this could work yes:

user=> (defmacro $$ [& args] `(let [proc ^{:inherit true} (p/$ ~@args)] (p/check proc) nil))
#'user/$$
user=> ($$ ls README.md)
README.md
nil
user=> ($$ ls foo)
ls: foo: No such file or directory
[at <repl>:23:1]

borkdude 2020-11-08T18:29:41.229800Z

I don't know about babashka, but this is pretty wide-spread in bash scripts: do one thing after another by starting a new process

holmdunc 2020-11-08T18:32:34.231100Z

Thanks! Yeah, as a Bash replacement it's good to be able to do that kind of straight line code in scripts without typing much

borkdude 2020-11-08T18:32:54.231500Z

I have started a survey: https://nl.surveymonkey.com/r/H2HK3RC and from the responses I got there shelling out seems pretty common

✍️ 2
holmdunc 2020-11-08T19:22:00.233200Z

That nice macro nudged me to put it in a file and start using BABASHKA_PRELOADS 😀

🎉 2