diff --git a/API.md b/API.md
index cdea376..4e99d5e 100644
--- a/API.md
+++ b/API.md
@@ -1,62 +1,63 @@
# Table of contents
-- [`babashka.cli`](#babashkacli)
- - [`auto-coerce`](#auto-coerce) - Auto-coerces s to data
- - [`coerce`](#coerce) - Coerce string s using f
- - [`dispatch`](#dispatch) - Subcommand dispatcher.
- - [`format-opts`](#format-opts)
- - [`format-table`](#format-table)
- - [`merge-opts`](#merge-opts) - Merges babashka CLI options.
- - [`number-char?`](#number-char?)
- - [`opts->table`](#opts->table)
- - [`pad`](#pad)
- - [`pad-cells`](#pad-cells)
- - [`parse-args`](#parse-args) - Same as parse-opts but separates parsed opts into :opts and adds
- - [`parse-cmds`](#parse-cmds) - Parses sub-commands (arguments not starting with an option prefix) and returns a
- - [`parse-keyword`](#parse-keyword) - Parse keyword from s
- - [`parse-opts`](#parse-opts) - Parse the command line arguments args, a seq of strings.
- - [`rows`](#rows)
- - [`spec->opts`](#spec->opts) - Converts spec into opts format
-- [`babashka.cli.exec`](#babashkacliexec)
- - [`-main`](#-main) - Main entrypoint for command line usage.
- - [`main`](#main)
-# babashka.cli
-
-
-
-
-
-## `auto-coerce`
-``` clojure
+- [`babashka.cli`](#babashka.cli)
+ - [`auto-coerce`](#babashka.cli/auto-coerce) - Auto-coerces s to data.
+ - [`coerce`](#babashka.cli/coerce) - Coerce string s using f.
+ - [`dispatch`](#babashka.cli/dispatch) - Subcommand dispatcher.
+ - [`format-opts`](#babashka.cli/format-opts)
+ - [`format-table`](#babashka.cli/format-table)
+ - [`merge-opts`](#babashka.cli/merge-opts) - Merges babashka CLI options.
+ - [`number-char?`](#babashka.cli/number-char?)
+ - [`opts->table`](#babashka.cli/opts->table)
+ - [`pad`](#babashka.cli/pad)
+ - [`pad-cells`](#babashka.cli/pad-cells)
+ - [`parse-args`](#babashka.cli/parse-args) - Same as [parse-opts](#babashka.cli/parse-opts) but separates parsed opts into :opts and adds :cmds and :rest-args on the top level instead of metadata.
+ - [`parse-cmds`](#babashka.cli/parse-cmds) - Parses sub-commands (arguments not starting with an option prefix) and returns a map with: * :cmds - The parsed subcommands * :args - The remaining (unparsed) arguments.
+ - [`parse-keyword`](#babashka.cli/parse-keyword) - Parse keyword from s.
+ - [`parse-opts`](#babashka.cli/parse-opts) - Parse the command line arguments args, a seq of strings.
+ - [`spec->opts`](#babashka.cli/spec->opts) - Converts spec into opts format.
+- [`babashka.cli.exec`](#babashka.cli.exec)
+ - [`-main`](#babashka.cli.exec/-main) - Main entrypoint for command line usage.
+ - [`main`](#babashka.cli.exec/main)
+
+-----
+# babashka.cli
+
+
+
+
+
+## `auto-coerce`
+``` clojure
(auto-coerce s)
```
-
+Function.
Auto-coerces `s` to data. Does not coerce when `s` is not a string.
If `s`:
* is `true` or `false`, it is coerced as boolean
- * starts with number, it is coerced as a number (through `edn/read-string`)
- * starts with `:`, it is coerced as a keyword (through `parse-keyword`)
-
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L77-L103)
-## `coerce`
-``` clojure
+ * starts with number, it is coerced as a number (through Clojure's `edn/read-string`)
+ * starts with `:`, it is coerced as a keyword (through [`parse-keyword`](#babashka.cli/parse-keyword))
+
Source
+## `coerce`
+``` clojure
(coerce s f)
```
-
+Function.
Coerce string `s` using `f`. Does not coerce when `s` is not a string.
`f` may be a keyword (`:boolean`, `:int`, `:double`, `:symbol`,
`:keyword`) or a function. When `f` return `nil`, this is
interpreted as a parse failure and throws.
-
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L143-L149)
-## `dispatch`
-``` clojure
+Source
+## `dispatch`
+``` clojure
(dispatch table args)
(dispatch table args opts)
```
-
+Function.
Subcommand dispatcher.
@@ -72,7 +73,7 @@ Subcommand dispatcher.
```
When a match is found, `:fn` called with the return value of
- [`parse-args`](#parse-args) applied to `args` enhanced with:
+ [`parse-args`](#babashka.cli/parse-args) applied to `args` enhanced with:
* `:dispatch` - the matching commands
* `:args` - concatenation of unparsed commands and args
@@ -82,100 +83,100 @@ Subcommand dispatcher.
Provide an `:error-fn` to deal with non-matches.
- Each entry in the table may have additional [`parse-args`](#parse-args) options.
+ Each entry in the table may have additional [`parse-args`](#babashka.cli/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#L729-L761)
-## `format-opts`
-``` clojure
+Source
+## `format-opts`
+``` clojure
(format-opts {:as cfg, :keys [indent], :or {indent 2}})
```
+Function.
+Source
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L628-L632)
-## `format-table`
+## `format-table`
``` clojure
-
(format-table {:keys [rows indent], :or {indent 2}})
```
+Function.
+Source
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L566-L579)
-## `merge-opts`
+## `merge-opts`
``` clojure
-
(merge-opts m & ms)
```
-
+Function.
Merges babashka CLI options.
-
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L12-L15)
-## `number-char?`
-``` clojure
+Source
+## `number-char?`
+``` clojure
(number-char? c)
```
+Function.
+Source
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L53-L55)
-## `opts->table`
+## `opts->table`
``` clojure
-
(opts->table {:keys [spec order]})
```
+Function.
+Source
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L609-L626)
-## `pad`
+## `pad`
``` clojure
-
(pad len s)
```
+Function.
+Source
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L544-L544)
-## `pad-cells`
+## `pad-cells`
``` clojure
-
(pad-cells rows)
```
+Function.
+Source
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L546-L552)
-## `parse-args`
+## `parse-args`
``` clojure
-
(parse-args args)
(parse-args args opts)
```
+Function.
-
-Same as [`parse-opts`](#parse-opts) but separates parsed opts into `:opts` and adds
+Same as [`parse-opts`](#babashka.cli/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#L515-L522)
-## `parse-cmds`
-``` clojure
+Source
+## `parse-cmds`
+``` clojure
(parse-cmds args)
(parse-cmds args {:keys [no-keyword-opts]})
```
-
+Function.
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#L207-L217)
-## `parse-keyword`
-``` clojure
+Source
+## `parse-keyword`
+``` clojure
(parse-keyword s)
```
-
+Function.
Parse keyword from `s`. Ignores leading `:`.
-
[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L65-L70)
-## `parse-opts`
-``` clojure
+Source
+## `parse-opts`
+``` clojure
(parse-opts args)
(parse-opts args opts)
```
-
+Function.
Parse the command line arguments `args`, a seq of strings.
Instead of a leading `:` either `--` or `-` may be used as well.
@@ -209,31 +210,31 @@ 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#L267-L513)
-## `rows`
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L582-L584)
-## `spec->opts`
-``` clojure
+Source
+## `spec->opts`
+``` clojure
(spec->opts spec)
(spec->opts spec {:keys [exec-args]})
```
-
+Function.
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-L205)
-# babashka.cli.exec
+Source
+
+-----
+# babashka.cli.exec
-## `-main`
-``` clojure
+## `-main`
+``` clojure
(-main & args)
```
-
+Function.
Main entrypoint for command line usage.
Expects a namespace and var name followed by zero or more key value
@@ -246,11 +247,11 @@ 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#L97-L110)
-## `main`
-``` clojure
+Source
+## `main`
+``` clojure
(main & args)
```
-
-[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L92-L95)
+Function.
+Source
diff --git a/bb.edn b/bb.edn
index 802be8f..c0078b0 100644
--- a/bb.edn
+++ b/bb.edn
@@ -1,7 +1,7 @@
{:pods {clj-kondo/clj-kondo {:version "2022.05.31"}}
:deps {io.github.borkdude/quickdoc
#_{:local/root "/Users/borkdude/dev/quickdoc"}
- {:git/sha "ca5893c0d81f26443dd178a747d0851e75d39eca"}}
+ {:git/sha "026b4fab8570853e38c3097fe1f8619abc95b2e0"}}
:paths ["src" ".build"]
:tasks
@@ -26,7 +26,8 @@
:task (api/quickdoc (merge {:git/branch "main"
:github/repo "https://github.com/babashka/cli"
:toc true
- :var-links true}
+ :var-links true
+ :var-pattern :wikilinks}
cmd-line-opts))}
bump-release {:doc "Bump release counter"
diff --git a/src/babashka/cli.cljc b/src/babashka/cli.cljc
index 2749b3d..9bec57a 100644
--- a/src/babashka/cli.cljc
+++ b/src/babashka/cli.cljc
@@ -78,8 +78,8 @@
"Auto-coerces `s` to data. Does not coerce when `s` is not a string.
If `s`:
* is `true` or `false`, it is coerced as boolean
- * starts with number, it is coerced as a number (through `edn/read-string`)
- * starts with `:`, it is coerced as a keyword (through `parse-keyword`)"
+ * starts with number, it is coerced as a number (through Clojure's `edn/read-string`)
+ * starts with `:`, it is coerced as a keyword (through [[parse-keyword]])"
[s]
(if (string? s)
(try
@@ -513,7 +513,7 @@
opts)))
(defn parse-args
- "Same as `parse-opts` but separates parsed opts into `:opts` and adds
+ "Same as [[parse-opts]] but separates parsed opts into `:opts` and adds
`:cmds` and `:rest-args` on the top level instead of metadata."
([args] (parse-args args {}))
([args opts]
@@ -741,7 +741,7 @@
```
When a match is found, `:fn` called with the return value of
- `parse-args` applied to `args` enhanced with:
+ [[parse-args]] applied to `args` enhanced with:
* `:dispatch` - the matching commands
* `:args` - concatenation of unparsed commands and args
@@ -751,7 +751,7 @@
Provide an `:error-fn` to deal with non-matches.
- Each entry in the table may have additional `parse-args` options.
+ Each entry in the table may have additional [[parse-args]] options.
For more information and examples, see [README.md](README.md#subcommands)."
([table args]