An example on talking to a babashka-pod with common-lisp. Just tried it out for chills https://github.com/rorokimdim/stash/tree/master/scripting-examples/common-lisp
@dorabThanks for sponsoring on Github. Would you like an invite to the private sponsors channel?
How do you sponsor on Github? I've never done that, though I probably should...
Thanks for your kind donation on Kofi!
Well, it's not much, but there's so many different packages that I use every day. I made several one-off $/£/€ donations this morning and set a reminder to do the same next year. I'll make it a Lent thing!
Nice! :)
Oh, I see the opencollective link now...
@eamonn.sullivan You can go to https://github.com/sponsors/borkdude and then it should be self-explanatory I hope
Thanks for considering
As a sponsor you will get priority in bug reports and also access to the private sponsors channel, but the main thing is to ensure continuity of this project.
@pfeodrippe Thanks for sponsoring! Would you like to have access to the private sponsors channel?
Hi @borkdude o/ Yes, of course :) Thanks
What's the best way to achieve . ${MY_CNF_SCRIPT}
in babashka? Basically that file includes just a bunch of bash variables that can be then subsequently used later in the script. I'd like to reuse that file and just get the vars to babashka env
I have a legacy project that has extensive bash tooling and I'm extending that setup with a couple of separate scripts that use babashka instead of Bash
source is a builtin, it’s special that it ‘survives’ the ‘subprocess’, Have you tried making a script that itself does source
, and then source that bb script?
actually, I think just setting the env in your babashka and then sourcing that script might work
Yeah, that is what I imagined what I'll have to do – I thought there could be some nifty way to get the variables set by the script to be incorporated directly withing a babashka script. Thanks!
I don’t think so: The invoker must explicitly be setup to ‘adopt’ the changed env vars, and that’s what source
does.
Let me know if a simple source <http://bla.bb|bla.bb>
where bla does setenv works, I am curious (and at work and cannot check)
I do have a nifty hack here: produce some bash with babashka and source that ;) https://stackoverflow.com/a/64804398/6264
Ah, sneaky. You just output a script 🙂 Probably nicer to use process substitution? e.g.
source <(bb -o ...
sure
Nice, thanks!
Adam is working on some babashka scripts here, while streaming: https://www.twitch.tv/adam_james_tv
Oh nice, I actually asked him to do something like that
Sure. Thanks.
Is Adam from the stream in this channel?
I have a solution for his spec problem ;)
I don’t know, but I told him that I found his stream via your post so he’s at least aware of this slack
Never trust a man with two first names
Ah right. So what you can do:
/tmp $ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {borkdude/spartan.spec {:git/url "<https://github.com/borkdude/spartan.spec>" :sha "e5c9f40ebcc64b27b3e3e83ad2a285ccc0997097"}}}')
/tmp $ cat spartan.clj
(require '[spartan.spec])
(alias 's 'clojure.spec.alpha)
(s/valid? int? 1)
/tmp $ bb -f spartan.clj --uberscript spartan.uber.clj
/tmp $ bb spartan.uber.clj
true
Using alias
will avoid uberscript loading in the source from the "real" spec. And since spartan.spec create the clojure.spec.alpha namespace already, this is a good solution. I will change the spartan.spec README as well.Yeah, it's a partial drop-in since not everything in spec is implemented (generators and instrumentation). But the way it creates the clojure.spec.alpha namespace is non-standard which confuses the uberscript
If you are using uberscripts solely for the purpose of being able to run them from anywhere, an alternative might be to just add the script "project" directory to the path
I love it :)
Another alternative is to create "uberjars" from them and wrap it in a tiny bash wrapper if you don't want to type bb foo.jar
Hey, I resemble that remark 😉