Maybe it has been asked before but regarding task execution, how can I run a shell command referencing an autocomplete resolution that has been installed by a third party tool? (specifically sdkman)
you would like to capture the output right? often such tools write it to stderr, so you could do something like this:
(-> (shell {:err :string} "the-auto-complete-command) :err)
If the auto-complete command writes to stdout instead, you should swap the :err key with :outI don't need to capture the output
26: (shell "sdk" "selfupdate"))) sdkman:update
^--- Cannot run program "sdk": error=2, No such file or directory
ok, sdk is a zsh function or so?
no, it's a bash autocompletion base
complete -o default -F _sdk sdkI have no idea why it was not defined as a function or a bin
but what are you trying to do, get autocompletions or run the sdk command?
run it
I think you should run it through your shell like this:
(shell (System/getenv "SHELL") "-c" "sdk")not sure if "-c" is the same for every shell
invoking it like that does not load the .*rc file, right?
don't know. perhaps it helps to write a separate script which sources the sdk stuff and then runs the command
and then execute that script instead
hmm. frustrating. not your fault, though, it's sdkman being creative
https://chatgpt.com/share/682c30e0-4dfc-8012-af36-f4857d6e8b51 ;)
that worked for me:
user=> (babashka.process/shell "zsh" "-c" "source \"$HOME/.sdkman/bin/sdkman-init.sh\" && sdk version")
SDKMAN!
script: 5.19.0
native: 0.7.4 (macos aarch64)no idea why my version couldn't run source
I would like to use some Clojure code I've written from Python. Trying to think, would it be a worthwhile exercise for me to port the pods library to Python so that I can use any pod from Python? Certainly fun, but would like opinions on whether worthwhile/ generally useful?
@borkdude Here it is; python-pods: https://github.com/judepayne/python-pods Please have a quick look, then I will announce it on this channel. It was a fun project!
Sure why not :)
lol. ok!
I did a bit of searching and I found that someone has done an elixir port of pods here: https://hexdocs.pm/pods/1.0.0/examples.html
Thanks will take a look this evening. There’s also this: https://github.com/Rohan2002/pypods but this is a port of the idea of pods and can only run python as a way of controlling dependencies. I am more interested in a faithful port
that's very cool!
😀 golang next at some point over the summer. If this library gets to 20 stars, there's one PR that babashka pods could use; Allowing for code strings (edn readers and functions that return "code") in maps
{:py "the python code for this", :clj "the clojure code for this}. This would be backwards compatible
makes sense. how did you now solve it when a pod uses "code" that returns clojure code?
Babashka is amazing with AI agents to develop Clojure. It lets them run tests or an ephemeral repl almost instantly.
I had a vague memory that (throw (ex-info "Criterion not satisfied" {:babashka/exit 1})) was a thing but couldn’t find it in the babashka book. Ultimately found it a few pages back in search here in slack. This will let us remove some (System/exit 1)s that we have in some functions which I’m a huge fan of. But they didn’t implement it that way due to discoverability. So i guess this is just feedback to document this somewhere the next time someone is editing the book or other docs
Github issue welcome
on it. thanks!
bug report or feature request? blank?
ah! right. i was doing it against babashka itself. thanks
Bug? In clojure, a record with :type metadata will return the value from the metadata when called with type, but in bb it will return the record. (In other words, :type has priority in clojure)
seems like a bug. where did you run into it? can you post an issue?
I was just playing around trying some things... Nothing critical. I created the issue: https://github.com/babashka/babashka/issues/1822
Already fixed... you're a machine! 😄