For breaking changes, check here.
Babashka CLI: turn Clojure functions into CLIs!
- Fix #102:
format-table
correctly pads cells containing ANSI escape codes - Fix #106: Multiple options before subcommand conflict with subcommand
- Fix #104: Allow extra arguments to be passed before options in exec function
- Fix #98: internal options should not interfere with :restrict
- Fix #96: prevent false defaults from being removed/ignored
- Fix #91: keyword options and hyphen options should not mix
Fix #89: long option never represents alias
Fix #82: prefer alias over composite option
- Add
:opts
to:error-fn
input - Fix command line args for test runner
--dirs
,--only
, etc
- Fix
--no-option
(--no
prefix) in combination with subcommands
- Prioritize
:exec-args
over spec:default
s dispatch
improvements (@Sohalt, @borkdude):- The
:cmds
order of entries in the table doesn't matter - Support parsing intermediate options:
foo --opt1=never bar --opt2=always
- The
- #68: alternative to shutdown-agents similar to clojure CLI's
-X
and-T
behavior
- #64: Support combined short options:
-abc
=>{:a true :b true :c true}
- #17: Support
--no-
prefix for negative flags:--no-colors
=>{:colors false}
- Improve
auto-coerce
: coerce"nil"
tonil
(@teodorlu)
- Improve
auto-coerce
for keywords (@teodorlu)
- Make
babashka.exec
compatible with clojure CLI1.11.1.1152
+
- #58: implicit true should not be transformed to string value
- Preserve exception cause in coercion for better error messages
- #56:
:exec-args
should be replaced, not merged
- #55: Last keyword option not parsed when previous value is implicit boolean
- Add
:org.babashka/cli {:exec true}
to arg map's metadata when invoking functions withbabashka.cli.exec
.
- #48: allow overriding
:exec-fn
on command line
- #46: fix trailing boolean option coercion
- #39: handle
:exec-args
withfalse
default
- Be tolerant of tags in
clojure.basis
- Added
:error-fn
to handle errors (@jmglov) - Merge
:spec
options with additional "terse" options
- Added
:require
to throw on missing options - Added
:validate
to throw on invalid options - Support
parse-opts
options indispatch
table entries - Add
:args->opts
inparse-opts
to consume positional arguments as options - Renamed
:aliases
to:alias
(with backwards compatibility) - Renamed
:closed
to:restrict
(with backwards compatibility) - Renamed
:cmds-opts
toargs->opts
(with backwards compatibility)
- Support
:closed
inparse-args
/parse-opts
for throwing on unrecognized options. - Fix default-width calculation in format-opts
- Improve
babashka.cli.exec
for babashka - Improve auto-parsing
- Improve auto-coercion and keyword arguments
- Accept both
:foo
andfoo
as string to be coerced into:foo
keyword.
cli/auto-coerce
should not coerce when input is not a string
- Compatibility with Clojure 1.9 and older versions of ClojureScript
- #10: Auto-coerce values using
cli/auto-coerce
- Clean up unnecessary dependency
- #22: respect
:default
in:spec
- #20: Preserve namespace in
format-opts
output. - Fix coercion with
:spec
.
format-opts
for help output + spec format
- Support parsing of trailing
:args
. See docs.
:no-keyword-opts
to treat:foo
as option value rather than option name
- Allow
nil
to be a valid coerced value
- The
:coerce
option now supports a collection and type:[:keyword]
which makes:collect
redundant and henceforth deprecated. The shorthand:keywords
introduced in v0.2.16 is removed (breaking).
- Support
:coerce
+:collect
shorthands
- Support
:ns-default
in deps alias
- Support
:exec-fn
in deps alias
- Support
:exec-args
on ns metadata
- Support
:exec-args
in parse options to provide defaults
- Add support for subcommands
- Introduce
parse-opts
which replacesparse-args
and returns a single map.
- Support
:org.babashka/cli
options indeps.edn
aliases.
- Support
:exec-args
in alias
- Separate namespace and invoked function in
exec
- Support
--foo=bar
syntax
- Move metadata to
org.babashka/cli
- Allow implicit boolean options to be collected
- Support
:collect
option for collecting values into collection - Support boolean
true
options without explicit boolean value and coercion
- Support
:aliases
- Support keywords in
coerce
: ``:boolean,
:int`, `:double`, `:symbol`, `:keyword` - Support
--foo
and-foo
as syntax sugar for:foo
Initial release
- Unreleased: The exception thrown on coercion failures no longer contains the
:input
and:coerce-fn
keys in its ex-data. See the "Error handling" section in the README for details on the new exception format. - v0.2.17: The shorthand
:keywords
introduced in v0.2.16 is removed (breaking).