Skip to content

Commit 4301ddb

Browse files
authored
docs: fix typo in parse-opts docstring (#133)
Note that quickdoc run also picked up removal of `scratch` namespace from #131.
1 parent 2c29891 commit 4301ddb

2 files changed

Lines changed: 16 additions & 43 deletions

File tree

API.md

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
- [`babashka.cli.exec`](#babashkacliexec)
2020
- [`-main`](#-main) - Main entrypoint for command line usage.
2121
- [`main`](#main)
22-
- [`scratch`](#scratch)
23-
- [`-main`](#-main-1)
24-
- [`dns-get-spec`](#dns-get-spec)
25-
- [`dns-spec`](#dns-spec)
26-
- [`global-spec`](#global-spec)
27-
- [`table`](#table)
2822
# babashka.cli
2923

3024

@@ -66,7 +60,7 @@ Coerce string `s` using `f`. Does not coerce when `s` is not a string.
6660

6761
Subcommand dispatcher.
6862

69-
Dispatches on longest matching command entry in [`table`](#table) by matching
63+
Dispatches on longest matching command entry in `table` by matching
7064
subcommands to the `:cmds` vector and invoking the correspondig `:fn`.
7165

7266
Table is in the form:
@@ -91,21 +85,21 @@ Subcommand dispatcher.
9185
Each entry in the table may have additional [`parse-args`](#parse-args) options.
9286

9387
For more information and examples, see [README.md](README.md#subcommands).
94-
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L728-L760)</sub>
88+
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L729-L761)</sub>
9589
## `format-opts`
9690
``` clojure
9791

9892
(format-opts {:as cfg, :keys [indent], :or {indent 2}})
9993
```
10094

101-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L627-L631)</sub>
95+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L628-L632)</sub>
10296
## `format-table`
10397
``` clojure
10498

10599
(format-table {:keys [rows indent], :or {indent 2}})
106100
```
107101

108-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L565-L578)</sub>
102+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L566-L579)</sub>
109103
## `merge-opts`
110104
``` clojure
111105

@@ -128,21 +122,21 @@ Merges babashka CLI options.
128122
(opts->table {:keys [spec order]})
129123
```
130124

131-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L608-L625)</sub>
125+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L609-L626)</sub>
132126
## `pad`
133127
``` clojure
134128

135129
(pad len s)
136130
```
137131

138-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L543-L543)</sub>
132+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L544-L544)</sub>
139133
## `pad-cells`
140134
``` clojure
141135

142136
(pad-cells rows)
143137
```
144138

145-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L545-L551)</sub>
139+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L546-L552)</sub>
146140
## `parse-args`
147141
``` clojure
148142

@@ -153,7 +147,7 @@ Merges babashka CLI options.
153147

154148
Same as [`parse-opts`](#parse-opts) but separates parsed opts into `:opts` and adds
155149
`:cmds` and `:rest-args` on the top level instead of metadata.
156-
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L514-L521)</sub>
150+
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L515-L522)</sub>
157151
## `parse-cmds`
158152
``` clojure
159153

@@ -209,15 +203,15 @@ Parse the command line arguments `args`, a seq of strings.
209203
```clojure
210204
(parse-opts ["foo" ":bar" "1"])
211205
;; => {:bar "1", :org.babashka/cli {:cmds ["foo"]}}
212-
(parse-args [":b" "1"] {:aliases {:b :bar} :coerce {:bar parse-long}})
206+
(parse-opts [":b" "1"] {:aliases {:b :bar} :coerce {:bar parse-long}})
213207
;; => {:bar 1}
214-
(parse-args ["--baz" "--qux"] {:spec {:baz {:desc "Baz"}} :restrict true})
208+
(parse-opts ["--baz" "--qux"] {:spec {:baz {:desc "Baz"}} :restrict true})
215209
;; => throws 'Unknown option --qux' exception b/c there is no :qux key in the spec
216210
```
217211

218-
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L266-L512)</sub>
212+
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L267-L513)</sub>
219213
## `rows`
220-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L581-L583)</sub>
214+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli.cljc#L582-L584)</sub>
221215
## `spec->opts`
222216
``` clojure
223217

@@ -252,32 +246,11 @@ Main entrypoint for command line usage.
252246
clojure -M:exec clojure.core prn :a 1 :b 2
253247
;;=> {:a "1" :b "2"}
254248
```
255-
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L89-L102)</sub>
249+
<br><sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L97-L110)</sub>
256250
## `main`
257251
``` clojure
258252

259253
(main & args)
260254
```
261255

262-
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L84-L87)</sub>
263-
# scratch
264-
265-
266-
267-
268-
269-
## `-main`
270-
``` clojure
271-
272-
(-main & args)
273-
```
274-
275-
<sub>[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L15-L17)</sub>
276-
## `dns-get-spec`
277-
<sub>[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L8-L8)</sub>
278-
## `dns-spec`
279-
<sub>[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L7-L7)</sub>
280-
## `global-spec`
281-
<sub>[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L4-L6)</sub>
282-
## `table`
283-
<sub>[source](https://github.com/babashka/cli/blob/main/src/scratch.clj#L10-L13)</sub>
256+
<sub>[source](https://github.com/babashka/cli/blob/main/src/babashka/cli/exec.clj#L92-L95)</sub>

src/babashka/cli.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@
291291
```clojure
292292
(parse-opts [\"foo\" \":bar\" \"1\"])
293293
;; => {:bar \"1\", :org.babashka/cli {:cmds [\"foo\"]}}
294-
(parse-args [\":b\" \"1\"] {:aliases {:b :bar} :coerce {:bar parse-long}})
294+
(parse-opts [\":b\" \"1\"] {:aliases {:b :bar} :coerce {:bar parse-long}})
295295
;; => {:bar 1}
296-
(parse-args [\"--baz\" \"--qux\"] {:spec {:baz {:desc \"Baz\"}} :restrict true})
296+
(parse-opts [\"--baz\" \"--qux\"] {:spec {:baz {:desc \"Baz\"}} :restrict true})
297297
;; => throws 'Unknown option --qux' exception b/c there is no :qux key in the spec
298298
```
299299
"

0 commit comments

Comments
 (0)