babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-06-29T05:16:05.249100Z

@cfleming ?

cfleming 2021-06-29T05:24:03.249300Z

So there isn’t really a great solution for this at the moment. I’m working on it though, assuming there are no major hiccups bb support will be in the next Cursive version (1.11, I’ve had more 1.10.x releases than expected due to bugs).

⭐ 1
Brandon Stubbs 2021-06-29T18:11:51.251900Z

Hey, I am not an advanced user of Clojure yet, but I was trying to do the following in Babashka (load a script in another script and try execute it's functions) foo script

#!/usr/bin/env bb
(ns foo)

(when (= *file* (System/getProperty "babashka.file"))
  (load-file "bar")
  (println (ns-interns 'bar)) ;; => {test #'bar/test}
  ;;(bar/test) <-- how to execute loaded functions?
  )
bar script
#!/usr/bin/env bb
(ns bar)

(defn test [] (println "test"))
If someone could point me in the right direction on how I could execute functions from the loaded script? Thank for your time and the awesomeness that Babashka is

borkdude 2021-06-29T20:11:45.253100Z

@brandon746 You should be able to load the functions like that.

borkdude 2021-06-29T20:12:43.254200Z

In a multi-file project it's more common to have a bb.edn like {:paths ["script"]} and then put bar.clj in the script directory so you can use (require '[bar :as b])

borkdude 2021-06-29T20:15:24.254400Z

@brandon746 See: https://book.babashka.org/#project-setup

borkdude 2021-06-29T20:57:22.254900Z

@brandon746 Btw, welcome! You are the 600th member of this channel! :)

🎉 2
Brandon Stubbs 2021-06-29T21:06:06.255100Z

Thank you very much 🙂 I would use the local bb.edn normally, but what I am trying to achieve is similar to the question you asked here: https://github.com/babashka/babashka/issues/819 Basically a library to turn tasks into a global cli. So I can add the directory to my PATH, which will contain something like:

brandon
brandon-git
brandon-aws
This way the brandon root will control the entire cli. So you could then execute brandon aws bucket-delete x brandon git assigned-prs So the logic for the aws commands sit within brandon-aws but the root brandon will dispatch them

borkdude 2021-06-29T21:07:15.255500Z

ah I see. What you could do in that case is use add-classpath on a path that's a combination of *file* and a relative directory

borkdude 2021-06-29T21:07:26.255800Z

and then you can use require from after that

borkdude 2021-06-29T21:07:54.256Z

you could just add the parent file of *file* to the classpath, (which is the directory of the file you're executing)

Brandon Stubbs 2021-06-29T21:08:03.256200Z

Ah great thanks! Let me give that a go

borkdude 2021-06-29T21:13:05.256500Z

borkdude 2021-06-29T21:40:43.256800Z

Updated the babashka news page with highlights from: - May https://github.com/babashka/babashka/blob/master/doc/news.md#2021-05 - June https://github.com/babashka/babashka/blob/master/doc/news.md#2021-06

1