babashka 2026-09-21

I'm trying to build a semi-complicated CLI tool, and I found out that babashka.cli handles keyword arguments as options by default, and doesn't put them into options as requested with args->opts. Example:

user> (cli/parse-args [":keyword" ":something"] {:args->opts [:arg1 :arg2] :spec {:arg1 {:default :test1 :coerce :keyword} :arg2 {:default :test2 :coerce :keyword}}})
{:opts {:arg1 :test1, :arg2 :test2, :keyword :something}}

user> (cli/parse-args ["keyword" "something"] {:args->opts [:arg1 :arg2] :spec {:arg1 {:default :test1 :coerce :keyword} :arg2 {:default :test2 :coerce :keyword}}})
{:opts {:arg1 :keyword, :arg2 :something}}
I understand the use case I think, but I'd like to suppress this automatic handling of keyword options and get the second case with the user providing the "keyword colon" as in the first case.

✅ 1

yeah you can turn that off, let me check

I think it's :no-keyword-opts

oh, great, thanks!

yep, that works. Thanks for the quick help!