Repository navigation
Specs can now declare the environment variables a command reads with a new env node. This release also makes Tab completion offer flags instead of file names when no positional argument is left, and loads large specs much faster.
Added
-
(spec) A new
envnode declares an environment variable that a command reads but that isn't the value of any flag (#1689). Put it inside acmdfor a variable that command reads, or at the top level for one the whole program reads. Proposed in discussion #1688.cmd "shell" help="Open a shell in the worktree" { env "SHELL" help="The program to open" default_note="bash" }
- Markdown docs list the variable under Environment on the command's page. Man pages list it in the command's section, and top-level variables get an
ENVIRONMENTsection. usage generate jsonincludes it asenvson the command.unknown_envtreats it as declared, including when it is hidden.usage lintadds two rules:missing-env-help(info) andduplicate-env(error).
The node supports
help,long_help,default_note,deprecatedandhide. It only documents the variable: usage never reads it or applies the default, and subcommands don't inherit it. Library users get a newSpecEnvtype and aSpecCommand::envsfield. The Rust derives don't emitenvnodes yet, so for now you have to declare them in KDL. - Markdown docs list the variable under Environment on the command's page. Man pages list it in the command's section, and top-level variables get an
Fixed
- (complete)
complete-wordno longer offers file names when the command takes no more positional arguments and has no subcommands (#1681). Pressing Tab on an empty word now lists the command's flags. A word that doesn't start with-, or any word after--, gets no candidates. For example,mise run <task> <Tab>for a task that has only flags now shows those flags instead of the current folder. Thanks to @roalcantara for reporting it in #1679.
Performance
- (spec) Large specs load faster, which speeds up every Tab completion (#1683, #1684). The KDL parser is about 3x faster and produces the same results and errors as before. Global flags are also no longer copied into every command during spec loading. On mise's spec, completing
mise use <Tab>takes about 57% fewer instructions.
Full Changelog: v7.4.1...v7.5.0
💚 Sponsor usage
usage is built and maintained by @jdx, an open source developer at entire.io, the title sponsor of his open source work.
If usage powers CLI specs, docs, or completions for a tool you maintain or use, please consider becoming an individual or company sponsor. Your support funds ongoing development and helps keep usage fast, free, and independent.