Fork me on GitHub
#babashka
<
2022-09-02
>
jmglov11:09:29

Looks like you've found the answers to all of your questions, right? Is there anything outstanding that you still want to know? If so, I can try to help, having done this sort of thing a lot myself. 🙂

imre11:09:25

Thanks, I actually did but in the wrong channel. Just reposted here for others in case they need it

1
grzm14:09:38

I’ve got a babashka script that I call directly using a she-bang in the script itself, e.g., #!/usr/bin/env bb. It doesn’t have any dependencies other than what’s already bundled in babashka. If I happen to call it while in a directory that includes a bb.edn file, it notices the bb.edn and attempts to fetch all of the dependencies that are in the bb.edn file. Is there a way for me to tell bb to ignore the bb.edn file? Or do I just need to make sure I’m not calling that script from a directory that also has a bb.edn file? (Note, the script itself does is not in a directory that has a bb.edn file. Think

$ ls bb.edn
bb.edn
$ head -n1 ../../script/some-bb-script
#!/usr/bin/env bb
$ ../../script/some-bb-script
# attempts to fetch all of the deps in bb.edn

borkdude14:09:11

You can do --classpath "" to avoid deps from bb.edn

borkdude14:09:19

or BABASHKA_CLASSPATH=""

grzm14:09:07

I did explore the --classpath "" and noticed that the "babashka.config" System property was still referencing the bb.edn file. Is that expected? I kinda expected it to be empty.

borkdude14:09:30

yes, but it should not load any deps

grzm14:09:41

Cool. I’ll give that a shot.

borkdude14:09:58

you could also try: --config nil I'm not sure if that works or throws

borkdude14:09:07

I think it will throw

borkdude14:09:34

Hmm:

$ bb --config nil -e '(+ 1 2 3)'
6

borkdude14:09:12

Seems to work also in case of an invalid bb.edn :)

grzm14:09:27

Yup, just tested that, too 🙂

grzm14:09:19

I kinda like the idea of being able to pass --config nil or --no-config or something, as it’s a bit more explicit and doesn’t have babashka.config set. I can rationalize the current behavior as well. (Though I do think throwing with an invalid bb.edn would be really useful)

borkdude14:09:55

I mean, config nil does the right thing with an invalid config: it ignores it

borkdude14:09:59

so it already works?

grzm14:09:15

Oh, I think I misunderstood. I thought it was silently ignoring an invalid config. If the --config nil is letting it ignore the invalid config, yeah, I think that’s perfect 😉

grzm14:09:29

Cheers! 🧇

🧇 1