usage generate completion
- Usage:
usage generate completion [FLAGS] <SHELL> <BIN> - Aliases:
c - Effect: read-only
- Source code:
cli/src/cli/generate/completion.rs
Generate a shell completion script for bash, fish, nu, powershell, or zsh
The script is a shim: on each Tab it hands the words typed so far to usage complete-word, so usage must be installed wherever the script is. The spec comes from --file, or from running --usage-cmd at completion time, which keeps a CLI that prints its own spec from ever going stale.
Arguments
<SHELL>— The shell to generate the script forChoices:
bash,fish,nu,powershell,zsh<BIN>— The name of the CLI being completed, as it is typed at the prompt
Flags
--install— Install the script where this shell looks for it, instead of printing itWrites the script file and nothing else: no shell rc file and no PowerShell profile is edited. Where a shell needs a one-time line of its own — zsh's
fpath+=, PowerShell's dot-source — it is printed for you to add.Effect: modifies state
--force— Replace a file at the target path that usage did not writeEffect: modifies state
-f --file <FILE>— A usage spec file, or a script with a usage shebang; "-" reads stdin--cache-key <CACHE_KEY>— Cache what --usage-cmd prints under this key, so it runs once per key rather than on every Tab; the CLI's version is a good key--usage-bin <USAGE_BIN>— Theusageexecutable the script calls back to, when it is notusageon PATHDefault:
usageEnvironment Variable:
JDX_USAGE_BIN--usage-cmd <USAGE_CMD>— A command that prints the CLI's spec, run in place of reading --fileFor a CLI that answers with its own spec, such as
mycli __usage_spec__, so the script always completes the version that is installed. Required unless --file is given.-h --help— Print help