Fork me on GitHub
#babashka
<
2021-03-07
>
Kira Howe13:03:20

Are people using babashka to make command-line apps (i.e., more than just personal scripts, ones that are shareable, versioned, etc)? I just came across https://github.com/nubank/docopt.clj, and the first example shows usage babashka. It seems really cool, but it got me wondering how to distribute a util made with babashka. Sharing a gist is the first thing that came to mind 😅 but is there a way to share it as an actual app/executable?

borkdude13:03:24

@kiraemclean Welcome! Babashka nowadays has the ability to set the classpath from within a script. Here is an example for camel-snake-kebab: https://github.com/babashka/babashka/blob/master/doc/projects.md#camel-snake-kebab

borkdude13:03:01

Feel free to update those docs for docopt as well

Kira Howe13:03:17

I was also wondering about how to share/distribute Babashka scripts.. in practice I'm basically trying to decide between making a cli with Clojure and building a native image vs. making a Babashka script (I think I can do everything I want with it, but not actually sure yet). Is that an intended use of Babashka, though? I guess my real question is, is there a good way to package a distribute a Babashka "app", or is that not really what it's for?

Kira Howe13:03:12

apologies for probably missing an obvious answer.. I'm just starting to use Babashka a little bit, but so far only for personal things (which is already amazing!)

borkdude13:03:42

It's a very good question. So far people usually put their scripts in a git repo which you can then just clone on your machine, and possibly put it to your $PATH

Kira Howe13:03:25

makes sense.. that's a really useful example, thanks!

borkdude13:03:05

I've been thinking if we should maybe have some central repo for all kinds of scripts that people can contribute to and selectively install from, but I haven't really thought deeply about it

Kira Howe13:03:59

interesting! that could be cool for sure. I guess at the end of the day if you want a platform-agnostic executable you'll have to just make a native image.. I suppose it could still use Babashka though, or just have it as a dependency that could be managed by brew or other package managers..

borkdude13:03:23

yeah, you could also distribute scripts via normal package managers for sure

borkdude13:03:57

I guess the solution will work itself out if the script becomes really popular

Kira Howe13:03:59

interesting.. anyway, just got me thinking. I usually put off thinking about how people are actually going to use my code until too late and then regret not making different decisions early on 😆 trying to force myself to finally learn the lesson..

Kira Howe13:03:10

yeah I think you're right.

Kira Howe13:03:41

it totally makes sense not to go crazy with packaging/deployment concerns for experiments.

borkdude13:03:07

People sometimes also use gists. Here is one for an http server a la python -m http.server: https://gist.github.com/holyjak/36c6284c047ffb7573e8a34399de27d8 But gists are generally a bit difficult to work with if you want to collaborate

Kira Howe13:03:47

yeah just putting it in a gist was my first thought.. that's usually how I've shared little one off scripts before