- When there are a large number of flags/subcommands, split the synopsis across multiple lines, breaking at 120 characters
- Ignore leading whitespace on consecutive lines of flag docs
- Hide
:no-docflags from help text - Correctly quote in .zshrc completion declaration
- Fix completion when no docstring is present
- Experimentally add zsh and bash completions
- Support both
:commandand:commandson the same level
- When having named positional arguments and trailing unnamed positional arguments, assign them correctly
- Add source tracking (config provenance) for keys in the initial context
- Only apply flag defaults if they are not yet present in the initial context
:middlewarecan now be a single function, not only a sequence of functions
- [BREAKING] When setting a
:handlerfor a boolean flag (one that looks like--[no-]...), the handler now receives the boolean value as a second argument - [BREAKING] Invoke flag handlers/middleware in the order they are specified, so that later flags can override earlier flags
- Support
:middlewarein command specs, not just in flag handlers
- Call
parseof default value, as documented, also when no:handlerfor a flag is specified. Fixes #9
- Add provenance tracking,
:lambdaisland.cli/sourcesis a map from options key to human readable description of where that key came from, e.g.--foo command line flag, orpositional command line argument idx=0. See lambdaisland/config for a use case.
- Allow using a var that points to a map as a command specification
- Add missing require for
clojure.pprint
- Added
:coll?flagopt for flags that can be specified multiple times - Correctly print multiline flag docstrings
- Make sure
cli/*opts*reflects what the main command receives
- Allow
:initalso on nested subcommands, gets merged into top level init. Flags are processed afterwards, so this is good way to set initial data that flags can filter/change - Flags handlers can now be specified directly as vars, the docstring is used as flag doc
- Fix generated help text when subcommand is not recognized
- When catching a top-level exception, print the ex-data, if any
- If the ex-data contains an
:exitkey, use that as exit code instead of 1 - Rework the help layout be more man-page-like
- Show correct help for subcommands
- Change the help layout to be man-page style
- When catching a top-level exception, print the ex-data (if any)
- Use the
:exitin the ex-data as exit code (1 otherwise)
- Better help messages: say why we are showing the help (no such command, missing positional args)
- Exit with error message if conditional arguments are missing
- Added
:requiredfor:flags - Support commands with arguments and subcommands at the same time
- Remove debug call
-hcan now be used to get help, in addition to--help
- When encountering parse errors (invalid arguments), print a message and exit, rather than throwing (which looks quite ugly from a bb script)
- Allow a command spec to be just a function
- Preserve command order in help text when using a vector
- Bind the options map to
cli/*opts*, for easy access. - Show the default for a flag in the help text.
- Add a docstring to the main entry point (
dispatch) - Bind
*opts*during flag handler execution
- Recognize
-and\\--fooas positional args
- When given both a
:defaultand a:handlerfor a flag, call the handler with the default, rather than just assoc-ing it. - When given a string
:defaultand a:parsefunction for a flag, run the default value through the parse function, rather than using it directly. Using the unparsed string form for the default is preferable over for instance using a keyword, since it leads to better help text rendering. - Improve and document the processing logic, especially when it comes to subcommand flags with handler functions.
Much expanded and improved version, see README for all details. This is approaching the envisioned scope for this library.
- take docstring/command from var
:strict?mode:handlerand:middlewareon flags- Much improved help text rendering
- More lenient flag parsing
- Add
:defaultand:parse
- Handle named command arguments
- Support
--flag FOOand--flag=<foo>(and--flag <foo>) - Boolean flags count by default, e.g.
-vvv=>{:verbose 3}
- Command handlers take a single unified map
- subcommand handling
- rudimentary flag handling
- help text generation