Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jan 4, 2024
1 parent 257774f commit 73e03eb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,25 @@ E.g.:
:args ["arg"]}
```

Note that specs are not merged, such that:

``` clojure
(cli/dispatch table ["sub1" "--foo" "bar"])
```

returns `{:dispatch ["sub1"], :opts {:foo "bar"}}` (`"bar"` is not coerced as a keyword).

Note that it is possible to use `:args->opts` but subcommands are always prioritized over arguments:

``` clojure
(def table
[{:cmds ["sub1"] :fn identity :spec sub1-spec :args->opts [:some-opt]}
{:cmds ["sub1" "sub2"] :fn identity :spec sub2-spec}])

(cli/dispatch table ["sub1" "dude"]) ;;=> {:dispatch ["sub1"], :opts {:some-opt "dude"}}
(cli/dispatch table ["sub1" "sub2"]) ;;=> {:dispatch ["sub1" "sub2"], :opts {}}
```

## Babashka tasks

For documentation on babashka tasks, go
Expand Down

0 comments on commit 73e03eb

Please sign in to comment.