Liking cljdoc? Tell your friends :D

Changelog

For breaking changes, check here.

Babashka CLI: turn Clojure functions into CLIs!

v0.11.73 (2026-06-19)

  • Shell completions: register the running script's file name (from babashka.file) in addition to :prog, so path invocations (e.g. ./script.clj) complete without a :prog-named symlink. --prog may be repeated to register alias names. The program name is no longer restricted to ASCII; non-Latin names are supported.
  • #161, #163: docs: review and update. Nomenclature change: subcommand->command. For babashka cli library users, we used the term "subcommand". For users of clis created with babashka cli we use the term "command". They are the same thing. We now use the term "command" for both audiences. (@lread)
  • #168: Hide number-char? from the public API, it was accidentally included. (@lread)

v0.11.72 (2026-06-11)

  • #131: Exclude scratch.clj from released jar

v0.11.71 (2026-06-11)

  • dispatch now accepts a tree directly (as returned by table->tree). See Tree format
  • Subcommand table order is now preserved in printed help and completions

v0.11.70 (2026-06-09)

  • #24 / #95: shell completions for dispatch CLIs (bash/zsh/fish/powershell/nushell): subcommands, options, option and positional values, and file arguments. Based on initial work from 2024 by @sohalt. See Completions
  • :no-doc now hides a spec option too, not just a subcommand. See Subcommands
  • --opt=val splits on the first = only: --header=k=v parses as "k=v" (everything after the second = was dropped before). --opt= now parses as an explicit empty-string value instead of a flag

v0.10.69 (2026-06-06)

  • #112: auto-generated --help for dispatch CLIs (Usage / Commands / Options, --help/-h on every (sub)command, terse errors). See Help
  • format-opts two-column help layout, plus terminal-width description wrapping. See Printing options and Terminal width
  • :inherit in dispatch: an option usable before or after its subcommand. See Subcommands
  • :restrict no longer flags :exec-args keys or parent-level options. See Restrict
  • An option given without a value now reports Missing value for option --foo

v0.9.68 (2026-05-23)

  • #141: docs: briefly cover adding production polish to a cli (@lread)
  • #144: deployed pom now reflects min supported clojure version & doc supported platforms/versions (@lread)
  • #147: opts->table accepts :columns to override auto-detected columns (@jeeger)
  • Expose parse-opts*: parses args to raw map, no coercion / defaults / validation
  • Expose coerce-opts: standalone coerce step
  • Expose validate-opts: standalone :restrict / :require / :validate step
  • Add apply-defaults: fills missing keys from :exec-args or spec :default
  • Coerce error data includes :implicit-true true when the failure was an implicit --foo with no value

v0.8.67 (2025-11-21)

  • #126: - value accidentally parsed as option, e.g. --file -
  • #124: Specifying exec fn that starts with hyphen is treated as option
  • Drop Clojure 1.9 support. Minimum Clojure version is now 1.10.3.

v0.8.66 (2025-07-12)

  • #122: introduce new :repeated-opts option to enforce repeating the option for accepting multiple values (e.g. --foo 1 --foo 2 rather than --foo 1 2)

v0.8.65 (2025-04-14)

  • #119: format-table now formats multiline cells appropriately (@lread)

v0.8.64

  • Remove pom.xml and project.clj for cljdoc

v0.8.63

  • #116: Un-deprecate :collect option to support custom transformation of arguments to collections (@lread)
  • Support :collect in :spec

v0.8.62 (2024-12-22)

  • Fix #109: allow options to start with a number

v0.8.61 (2024-11-15)

  • 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

v0.8.60 (2024-07-23)

  • Fix #98: internal options should not interfere with :restrict

v0.8.59 (2024-04-30)

  • Fix #96: prevent false defaults from being removed/ignored
  • Fix #91: keyword options and hyphen options should not mix

v0.8.58 (2024-03-12)

Fix #89: long option never represents alias

v0.8.57 (2024-02-22)

Fix #82: prefer alias over composite option

v0.8.56 (2024-02-13)

  • Add :opts to :error-fn input
  • Fix command line args for test runner --dirs, --only, etc

v0.8.55 (2024-01-04)

  • Fix --no-option (--no prefix) in combination with subcommands

v0.8.54 (2024-01-04)

  • Prioritize :exec-args over spec :defaults
  • 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

v0.7.53 (2023-09-28)

  • #72: add possibility to add a header to format-opts (@Sohalt)

v0.7.52 (2023-06-20)

  • #68: alternative to shutdown-agents similar to clojure CLI's -X and -T behavior

v0.7.51 (2023-04-17)

  • #64: Support combined short options: -abc => {:a true :b true :c true}
  • #17: Support --no- prefix for negative flags: --no-colors => {:colors false}

v0.6.50 (2023-03-18)

  • Improve auto-coerce: coerce "nil" to nil (@teodorlu)

v0.6.49 (2023-03-10)

v0.6.48 (2023-03-07)

  • Make babashka.exec compatible with clojure CLI 1.11.1.1152+

v0.6.46 (2023-02-19)

  • #58: implicit true should not be transformed to string value

v0.6.45 (2023-01-27)

  • Preserve exception cause in coercion for better error messages

v0.6.44 (2023-01-18)

  • #56: :exec-args should be replaced, not merged

v0.6.43 (2023-01-13)

  • #55: Last keyword option not parsed when previous value is implicit boolean

v0.6.41 (2022-12-11)

  • #52: require value specified as non-boolean to be supplied
  • #53: support parsing negative numbers

v0.5.40 (2022-10-12)

  • Add :org.babashka/cli {:exec true} to arg map's metadata when invoking functions with babashka.cli.exec.

v0.4.39

  • #48: allow overriding :exec-fn on command line

v0.4.38

  • #46: fix trailing boolean option coercion

v0.4.37

  • #39: handle :exec-args with false default

v0.4.36

  • Be tolerant of tags in clojure.basis

v0.3.35

  • Added :error-fn to handle errors (@jmglov)
  • Merge :spec options with additional "terse" options

v0.3.33

  • Added :require to throw on missing options
  • Added :validate to throw on invalid options
  • Support parse-opts options in dispatch table entries
  • Add :args->opts in parse-opts to consume positional arguments as options
  • Renamed :aliases to :alias (with backwards compatibility)
  • Renamed :closed to :restrict (with backwards compatibility)
  • Renamed :cmds-opts to args->opts (with backwards compatibility)

v0.3.32

  • Support :closed in parse-args / parse-opts for throwing on unrecognized options.
  • Fix default-width calculation in format-opts

v0.3.31

  • Improve babashka.cli.exec for babashka
  • Improve auto-parsing

v0.3.29

  • Improve auto-coercion and keyword arguments

v0.3.28

  • Accept both :foo and foo as string to be coerced into :foo keyword.

v0.3.27

  • cli/auto-coerce should not coerce when input is not a string

v0.3.26

  • Compatibility with Clojure 1.9 and older versions of ClojureScript

v0.2.25

v0.2.24

  • Clean up unnecessary dependency

v0.2.23

  • #22: respect :default in :spec

v0.2.22

  • #20: Preserve namespace in format-opts output.
  • Fix coercion with :spec.

v0.2.21

  • format-opts for help output + spec format

v0.2.20

  • Support parsing of trailing :args. See docs.

v0.2.19

  • :no-keyword-opts to treat :foo as option value rather than option name

v0.2.18

  • Allow nil to be a valid coerced value

v0.2.17

  • 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).

v0.2.16

  • Support :coerce + :collect shorthands

v0.2.15

  • Support :ns-default in deps alias

v0.2.14

  • Support :exec-fn in deps alias

v0.2.13

  • Support :exec-args on ns metadata

v0.2.12

  • Support :exec-args in parse options to provide defaults

v0.2.11

v0.2.10

  • Introduce parse-opts which replaces parse-args and returns a single map.

v0.2.9

  • Support :org.babashka/cli options in deps.edn aliases.

v0.1.8

  • Support :exec-args in alias

v0.1.7

  • Separate namespace and invoked function in exec

v0.1.6

  • Support --foo=bar syntax

v0.1.5

  • Move metadata to org.babashka/cli

v0.1.4

  • Allow implicit boolean options to be collected

v0.1.3

  • Support :collect option for collecting values into collection
  • Support boolean true options without explicit boolean value and coercion

v0.1.2

  • Support :aliases
  • Support keywords in coerce: ``:boolean,:int,:double,:symbol,:keyword`
  • Support --foo and -foo as syntax sugar for :foo

v0.1.1

Initial release

Breaking changes

  • v0.3.35: 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).

Can you improve this documentation? These fine people already did:
Michiel Borkent, Lee Read, Gert Goet, Josh Glover, Teodor Heggelund & Josh Glover [He/Him]
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close