babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2020-12-09T10:46:50.159Z

❤️ 6
isak 2020-12-09T19:17:03.159700Z

Very cool, I just had a problem this would have solved

borkdude 2020-12-09T19:17:43.159900Z

Can you describe the problem? This would be good feedback for something that's still under dev

isak 2020-12-09T19:18:14.160100Z

I tried shelling out for deps on windows, and it was just a nightmare figuring out the quoting/escaping, etc

borkdude 2020-12-09T19:18:57.160300Z

try using babashka.process, it has special logic for escaping args on windows

isak 2020-12-09T19:19:16.160500Z

It was actually that progress-bar thing that I wanted to add in a script, so I tried to shell out to clojure deps and add that to the classpath

borkdude 2020-12-09T19:19:42.160700Z

lol ok. yeah, babashka.deps will also solve that problem by allowing you to insert the deps map in the script itself without shelling out

borkdude 2020-12-09T19:20:33.160900Z

but you can do this also from babashka as of now by using babashka.classpath/add-classpath from within a script and babashka.process to shell out

isak 2020-12-09T19:21:23.161100Z

Sounds good. I was trying clojure.java.shell/sh

borkdude 2020-12-09T19:22:12.161300Z

(-> (babashka.process/process ["clojure" "-Spath" ...] {:out :string}) :out) will give you the classpath

borkdude 2020-12-09T19:23:13.161500Z

correction:

(-> (babashka.process/process ["clojure" "-Spath"] {:out :string}) deref :out)

borkdude 2020-12-09T19:26:22.161700Z

This should work on Windows given that babashka.process does some stuff to account for issues on Windows

isak 2020-12-09T19:27:11.161900Z

I tried that, but I guess I have other issues, because I just get this error:

java.io.IOException: Cannot run program "clojure": CreateProcess error=2

isak 2020-12-09T19:27:43.162100Z

This is with the clojure stuff installed via scoop, and I can reach them via the shell

borkdude 2020-12-09T19:27:55.162300Z

that's because clojure is a powershell thing in Windows. The solution/workaround for that is to use https://github.com/borkdude/deps.clj which you can also install via scoop clojure.

borkdude 2020-12-09T19:28:09.162700Z

And then shell out to deps instead of clojure

isak 2020-12-09T19:28:17.162900Z

gotcha

borkdude 2020-12-09T19:28:33.163100Z

It's clear that adding babashka.deps will give some gains here

➕ 1
isak 2020-12-09T19:29:54.163300Z

Nice, that made it work

borkdude 2020-12-09T19:38:28.163600Z

I wonder if that progress bar thing works on Windows btw. It's a different kind of terminal right

isak 2020-12-09T19:41:29.163800Z

Yea it works. If you mess with the display format, (e.g., to display the item title you are currently processing), it breaks though (fails to clear the last line if it was longer than the next one)