Usage is a spec and CLI for defining CLI tools. Arguments, flags, environment variables, and config files can all be defined in a Usage spec. It can be thought of like OpenAPI (swagger) for CLIs. Here are some potential reasons for defining your CLI with a Usage spec:
- Generate autocompletion scripts
- Generate markdown documentation
- Generate man pages
- Generate type-safe SDK client libraries for TypeScript, Python, and Rust
- Use an advanced arg parser in any language
- Scaffold one spec into different CLI frameworks-even different languages
- [coming soon] Host your CLI documentation on usage.sh
(powershell) Pressing Tab after a space (for example mise or mise use ) now offers subcommands and arguments instead of file names (#1672, @jdx). The completer had been dropping the trailing space before passing the line to the binary. The fix is in the Rust generator, the Go argv generator and the checked-in usage.ps1. Thanks to @kangmingxuan for reporting and diagnosing it.
(fish) Completion scripts made with usage generate completion fish --file spec.kdl now keep backslashes in the embedded spec (#1659, @jdx). Before, fish's single-quote unescaping took away one level of backslashes. A complete ... run= command with escapes such as jq's (.name), \t or a regex escape then turned into invalid KDL. When that happened, every completion for the binary silently returned nothing.
(cobra) Specs generated from Cobra commands with ValidArgs now pass usage lint, for both root commands and subcommands (#1670, @jdx). The generator now writes choice "dev" inside choices blocks instead of a bare "dev". Choices on flag arguments use the same format.