babashka 2026-10-22

@borkdude Thanks for addressing so quickly the bb issues that I had discovered while working on neorepl!

Sure, keep 'em coming. You can test with the dev build which you probably already know

๐Ÿ‘ 1

I know, I know. ๐Ÿ˜„

I'm sure I've seen a thread about this before, but I can't seem to find it. I want to re-use :cmd groups across bb projects. ๐Ÿงต

let's say I want to share bb site, originally defined in bb.edn as

site
  {:doc "Site commands"
   :cmd {"export"        {:exec-fn site/export}
         "build"         {:exec-fn site/build}
         "serve"         {:exec-fn site/serve}}}
I attempted to define the command in a library,
(ns site.cli)

(def command
  {:doc "Site commands"
   :cmd {"export"        {:exec-fn export}
         "build"         {:exec-fn build}
         "serve"         {:exec-fn serve}}})
then refer to it by name back in bb.edn
site #'site/command
... doesn't work, and I've tried a few other things. Is there a recommended way to make this work or do I have to go var-by-var? (which is no big deal)

@kpassapk You are on the right track, but a few modifications are needed: In the namespace the functions must become vars: :exec-fn #'export (so docstrings can be obtained etc) and in bb.edn:

site {:cmd site.cli/command}

yup. For the record,

site {:cmd site.cli/command}

yup. For the record

site {:cmd site.cli/command}
(ns site.cli)

(def command
  {"export"  {:exec-fn #'export}
   "build"   {:exec-fn #'build}
   "serve"   {:exec-fn #'serve}}})
thanks, this helps so much! it lets me compose CLIs across repos, and it works with the bb-transient project I shared here a couple of weeks ago.