This release improves the CLI's --help output to render all the documentation-related fields that were previously only used in manpage and markdown generation, adds stdin support for piping specs into usage commands, and fixes a long-standing zsh completion annoyance with trailing spaces.
Highlights
- The
--help/-houtput is now much richer, rendering examples, before/after help text, version headers, author/license info, and deprecation markers -- fields that were previously only surfaced in generated manpages and markdown. - You can now pipe a usage spec from another tool directly into usage via
--file -, enabling workflows likejbang usage | usage generate markdown --file -. - Zsh tab completions no longer insert unwanted trailing spaces after partial completions, fixing a bug reported nearly a year ago.
Added
-
The built-in
--help/-hrendering now includesbefore_help,after_help(and their_longvariants),examples, aname+versionheader,author/licensein the long help footer, and[deprecated: reason]markers on subcommands. Short help (-h) uses the base variants; long help (--help) prefers the_longvariants with a fallback to the base ones. (#554 by @jdx, closes #549)For example, a spec like:
before_help "Welcome to my CLI" after_help "See the project website for docs" example "mycli --verbose" header="Run with verbose output"
will now render those sections in
mycli --helpoutput, not just in generated docs. -
All
--fileflags acrossgenerate,lint, andcomplete-wordsubcommands now accept-to read the usage spec from stdin. This enables piping specs from other tools without writing a temporary file. (#555 by @jdx, closes #546)jbang usage | usage generate markdown --file - cat myspec.kdl | usage lint --file -
Not supported for
exec/shellsubcommands, which pass stdin through to the child process.
Fixed
- Zsh completions no longer append an unwanted trailing space after partial completions. Previously, completing
node@would producenode@(with a space), and path completions like/opt/homebrewwould not include a trailing slash. The generated zsh completion scripts now use_describewith-S ''instead of_argumentswith command substitution, and directory completions include a trailing/. If you have existing generated zsh completions, regenerate them to pick up this fix. (#556 by @jdx, closes #67)
Full Changelog: v3.0.0...v3.1.0