A parser fix for shell completions inside mounted commands. Addresses jdx/mise#11282, where the mounting CLI's global flags leaked into mounted task completions and non-global flags before a task hid the task from the parser.
Fixed
-
Mounted commands no longer inherit the mounting CLI's flags (#738). Three related defects in how the partial-parse's subcommand scan and re-parse interact with
mount:-
Globals leaked into mounted commands. For a CLI like mise, where everything after a task name is forwarded to the task,
mise run mytask --<TAB>used to offer--cd --env --jobs --locked --quiet --raw --silent --verbose --yeseven though the mounted program rejects them (unexpected word: --silent). Worse, when a mounted task declared a flag whose name collided with a global (e.g. its own--envwith choices), the global shadowed it and value completion fell back to file paths instead of the task's choices. Mounted commands are now marked internally and their own flags take precedence over inherited globals for their own names; a newParseOutput::completion_flags()returns just the flags a completion should offer once a mount boundary has been crossed. Globals stay recognized before the mounted command, and mount scripts still receive them. -
A non-global flag hid the subcommand behind it. Phase 1 stopped scanning at the first non-global flag, so
usage complete-word ... -- mise run --force build --bump ''failed withunexpected word: build. Known non-global flags are now consumed like globals and the scan continues; they are simply not forwarded to mounts. Unknown flags still stop the scan since their arity is unknown. -
Re-parsed prefix words could bind to the wrong flag. A global's value that appeared before a mounted command with a same-named flag would be re-validated against the mounted flag's choices and rejected. Phase 1 now records which flag each skipped word was read as, and Phase 2 respects that binding, so
mycli --env prod run task --env <TAB>still parses--env prodas the global and offers the task's--envchoices after the task name.
Documentation for
globalflags and mounted commands has been added underdocs/spec/reference/. -
Full Changelog: v3.5.6...v3.5.7
💚 Sponsor usage
usage is maintained by @jdx, an open source developer for entire.io, the title sponsor of the jdx.dev open source tools including mise, aube, hk, and more. Work on usage is funded by sponsorships.
If usage powers CLI specs, docs, or completions for a tool you maintain or use, please consider sponsoring at jdx.dev. Every sponsorship helps the project stay independent and moving.