Repository navigation
Description
The completion scripts generated by usage-argv
(usage --completions <shell>, mise completion <shell>, any usage-rs CLI)
insert candidates badly, and bash and zsh are wrong in opposite ways.
-
bash: a value attached with
=lands after its own prefix.$ usage complete-word --shell=ba<Tab> $ usage complete-word --shell=--shell=bash
The answer is the full word
--shell=bash, but Readline replaces only the text after=,
which is in the defaultCOMP_WORDBREAKS.
render_request(argv/src/complete.rs:1117) emits\x01prefixonly for:(line 1132).
It is the bug of Bash completion duplicates colon-prefixed task names on second Tab mise#12970, fixed by fix(bash): preserve colon-prefixed completion words #1405 and fix(completions): trim the colon prefix bash keeps for namespaced task names mise#13276 for:alone.
The usage-cli scripts trim both (${COMP_WORDBREAKS//[^:=]/}). -
bash: a space after every candidate, including those meant to be continued.
mise use node<Tab>givesmise use node@,
and acomplete type="dir"match givessub/.
The script registers with a barecomplete -F(argv/src/script.rs:262),
without the-o nospacewhich the usage-cli scripts, and mise up to 2026.8, had for exactly
this reason (Does it make sense to add space after command when auto-completing? mise#4243).
Paths behind the\x01dirs/\x01filesmarkers are fine thanks tocompopt -o filenames. -
zsh: no space after any candidate, even a finished one.
usage gen<Tab>givesusage generateand the cursor stays right after it,
and the same for every subcommand, flag, choice andcomplete run=value.
compadd ... -S ''(argv/src/script.rs:356) comes from fix(zsh): remove trailing space from completions and add directory slash #556,
which fixed zsh completion adds incorrect spaces #67 (node@,/opt/homebrew/) by dropping the suffix for all candidates.
Expected in both shells: a space after a finished value (generate, --shell=bash, alpha),
none after a partial one (node@, build:, sub/), and --shell=ba<Tab> → --shell=bash.
Repro for 2 and 3 with candidates of a mise task (mkdir -p sub/inner, mise trust):
[tasks.t]
usage = '''
flag "--c <c>" { choices "alpha" "beta"; }
flag "--d <d>" { complete type="dir"; }
'''
run = 'echo "$@"'| Typed | bash | zsh |
|---|---|---|
mise ru<Tab> |
mise run ✓ |
mise run (no space) |
mise run t --c al<Tab> |
--c alpha ✓ |
--c alpha (no space) |
mise run t --c=al<Tab> |
--c=--c=alpha |
--c=alpha (no space) |
mise run t --d su<Tab> |
--d sub/ (space) |
--d sub/ ✓ |
mise use node<Tab> |
mise use node@ (space) |
mise use node@ ✓ |
Found while building kongusage (https://github.com/powerman/kongusage, a Kong → usage spec
exporter), which emits choices and complete type=… so that mise tasks complete better than
with the shell's file completion; with these bugs they complete worse.
Reproduced in real bash 5.3 and zsh 5.9 with usage 7.3.0 and main (220ffb2),
and with mise 2026.11.0 (usage-argv 7.3.0, as in mise 2026.11.6 and main).
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: 2.1.318.
Activity