Fork me on GitHub
Nate Sutton01:01:12

so I was thinking about the goals of babashka

Nate Sutton01:01:25

it seems like it has the goal of streaming input to output pretty well solved

Nate Sutton01:01:09

but in the case of replacing bash for scripting there are a few use cases I typically use bash for

Nate Sutton01:01:48

1. mutating the bash environment. this is typically in .bash_profile or similar and can't really be replaced by babashka 2. running other processes and checking the output/result. babashka has that covered with ProcessBuilder and shell/sh (although a more clojure-ish ProcessBuilder would be nice) 3. calling out to services and doing something with the result. having clj.http.lite addresses this use case 4. manipulating files and the filesystem

Nate Sutton01:01:51

I don't have much to say about these use cases other than I'm trying to address #4. even if this fs library goes nowhere I'm at least exploring file manipulation and can hopefully expose more java classes/methods

Nate Sutton02:01:31

b*orkdude: I'm wondering where and how to add tests for functionality around adding classes/methods such that they fail in babashka. some kind of eval thing?

Nate Sutton02:01:53

I probably just need to revisit when I'm not so tired and it'll be clear to me


0.0.60 passed all tests here -- this was with xubuntu my windows 10 vm didn't survive, so i'll look into setting up another one


btw, regarding doing symlinks on windows -- iiuc, this won't work until jdk 13 if using "standard" methods.


two ideas: 1) use mklink 2) get working with graal

Nate Sutton04:01:05

would shelling out be an ok alternative if there was an emulation layer?

Nate Sutton04:01:02

I've wondered about this for this filesystem stuff, where shelling out would make the binary lighter while providing similar facilities


not sure really - windows stuff seems to be far weirder than my expectations (e.g. odd length limitations, bizarre quoting, strange dynamic linking rules, etc.). the mklink idea is the shelling out path. the jnr stuff looks pretty interesting - haven't tried it let alone getting it to work with graal.

Lyn Headley12:01:28

@nate_clojurians bb replaces bash for me in mutating the environment. Here is a line from my .bashrc: PATH=$(bb /home/laheadle/src/clj/bb-scripts/unique_path.clj)


Very cool! Would you be willing to share the bb code?

Nate Sutton14:01:41

I meant how PATH= is mutating the bash environment, though. bb is just reading the environment and printing output



$ babashka -e "(require '[spartan.spec :as s]) (s/explain (s/cat :i string?) [1])"
1 - failed: string? in: [0] at: [:i]

👍 3

export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {spartan.spec {:git/url "" :sha "104129aae9eab6dd4622937d0f46abeed9c9c537"}}}' -Spath)"
bb -e "(require '[spartan.spec :as s]) (s/explain (s/cat :i string?) [1])"
1 - failed: string? in: [0] at: [:i]

👌 1