Skip to content

Commit 43f59f1

Browse files
committed
Update docs and changelog
1 parent 77ce7bf commit 43f59f1

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Added
44

5+
- Added `:required` for `:flags`
6+
57
## Fixed
68

79
## Changed
@@ -87,4 +89,4 @@ approaching the envisioned scope for this library.
8789

8890
- subcommand handling
8991
- rudimentary flag handling
90-
- help text generation
92+
- help text generation

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ If you are explicit about which flags you accept, then you may prefer not to let
241241
you can set `:strict? true`. In this mode only explicitly configured flags are
242242
accepted, others throw an error.
243243

244-
A final possibility is to set `:middleware` for a flag, this is a function or
244+
Another possibility is to set `:middleware` for a flag, this is a function or
245245
list of functions that get wrapped around the final command.
246246

247247
```clj
@@ -257,6 +257,18 @@ list of functions that get wrapped around the final command.
257257
(cmd opts))))]}]}]})
258258
```
259259

260+
Finally, it's possible to set `:required`, to indicate for users that a flag
261+
must always be passed:
262+
263+
```clj
264+
(cli/dispatch
265+
{:command #'cli-test
266+
:flags ["-v, --verbose" "Increases verbosity"
267+
"--input FILE" "Specify the input file"
268+
"--env=<dev|prod|staging>" {:doc "Select an environment"
269+
:required true}] })
270+
```
271+
260272
### Commands
261273

262274
`lambdaisland/cli` is specifically meant for CLI tools with multiple subcommands

src/lambdaisland/cli.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@
413413
take an argument.
414414
- `:middleware` Function or sequence of functions that will wrap the command
415415
function if this flag is present.
416+
- `:required` Boolean value to indicate if the flag is required.
416417
417418
This docstring is just a summary, see the `com.lambdaisland/cli` README for
418419
details.

0 commit comments

Comments
 (0)