diff --git a/API.md b/API.md index 5d37a03..a57daa8 100644 --- a/API.md +++ b/API.md @@ -19,6 +19,12 @@ - [`babashka.cli.exec`](#babashkacliexec) - [`-main`](#-main) - Main entrypoint for command line usage. - [`main`](#main) +- [`scratch`](#scratch) + - [`-main`](#-main-1) + - [`dns-get-spec`](#dns-get-spec) + - [`dns-spec`](#dns-spec) + - [`global-spec`](#global-spec) + - [`table`](#table) # babashka.cli @@ -60,13 +66,13 @@ Coerce string `s` using `f`. Does not coerce when `s` is not a string. Subcommand dispatcher. - Dispatches on longest matching command entry in `table` by matching + Dispatches on longest matching command entry in [`table`](#table) by matching subcommands to the `:cmds` vector and invoking the correspondig `:fn`. Table is in the form: ```clojure - [{:cmds ["sub_1" .. "sub_n"] :fn f :cmds-opts [:lib]} + [{:cmds ["sub_1" .. "sub_n"] :fn f :args->opts [:lib]} ... {:cmds [] :fn f}] ``` @@ -85,21 +91,21 @@ Subcommand dispatcher. Each entry in the table may have additional [`parse-args`](#parse-args) options. For more information and examples, see [README.md](README.md#subcommands). -
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L672-L704) +
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L684-L716) ## `format-opts` ``` clojure (format-opts {:as cfg, :keys [indent], :or {indent 2}}) ``` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L571-L575) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L583-L587) ## `format-table` ``` clojure -(format-table {:keys [rows indent]}) +(format-table {:keys [rows indent], :or {indent 2}}) ``` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L531-L542) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L543-L554) ## `merge-opts` ``` clojure @@ -122,21 +128,21 @@ Merges babashka CLI options. (opts->table {:keys [spec order]}) ``` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L552-L569) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L564-L581) ## `pad` ``` clojure (pad len s) ``` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L521-L521) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L533-L533) ## `pad-cells` ``` clojure (pad-cells rows) ``` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L523-L529) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L535-L541) ## `parse-args` ``` clojure @@ -147,7 +153,7 @@ Merges babashka CLI options. Same as [`parse-opts`](#parse-opts) but separates parsed opts into `:opts` and adds `:cmds` and `:rest-args` on the top level instead of metadata. -
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L499-L506) +
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L504-L511) ## `parse-cmds` ``` clojure @@ -159,7 +165,7 @@ Same as [`parse-opts`](#parse-opts) but separates parsed opts into `:opts` and a Parses sub-commands (arguments not starting with an option prefix) and returns a map with: * `:cmds` - The parsed subcommands * `:args` - The remaining (unparsed) arguments -
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L205-L215) +
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L206-L216) ## `parse-keyword` ``` clojure @@ -207,9 +213,9 @@ Parse the command line arguments `args`, a seq of strings. ;; => throws 'Unknown option --qux' exception b/c there is no :qux key in the spec ``` -
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L259-L497) +
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L261-L502) ## `rows` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L545-L547) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L557-L559) ## `spec->opts` ``` clojure @@ -219,7 +225,7 @@ Parse the command line arguments `args`, a seq of strings. Converts spec into opts format. Pass existing opts as optional second argument. -
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L184-L203) +
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L184-L204) # babashka.cli.exec @@ -244,11 +250,32 @@ Main entrypoint for command line usage. clojure -M:exec clojure.core prn :a 1 :b 2 ;;=> {:a "1" :b "2"} ``` -
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L88-L101) +
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L89-L102) ## `main` ``` clojure (main & args) ``` -[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L83-L86) +[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L84-L87) +# scratch + + + + + +## `-main` +``` clojure + +(-main & args) +``` + +[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L15-L17) +## `dns-get-spec` +[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L8-L8) +## `dns-spec` +[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L7-L7) +## `global-spec` +[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L4-L6) +## `table` +[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L10-L13) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7742390..8781bed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ For breaking changes, check [here](#breaking-changes). [Babashka CLI](https://github.com/babashka/cli): turn Clojure functions into CLIs! -## Unreleased +## v0.8.61 (2024-11-15) - Fix [#102](https://github.com/babashka/cli/issues/102): `format-table` correctly pads cells containing ANSI escape codes - Fix [#106](https://github.com/babashka/cli/issues/106): Multiple options before subcommand conflict with subcommand diff --git a/version.edn b/version.edn index 8a3576b..b30021e 100644 --- a/version.edn +++ b/version.edn @@ -1 +1 @@ -{:major 0, :minor 8, :release 60} +{:major 0, :minor 8, :release 61}