Skip to content

fix(completion): use valid zsh _arguments exclusion-group syntax#22727

Closed
Sanjays2402 wants to merge 1 commit into
NousResearch:mainfrom
Sanjays2402:fix/issue-22686
Closed

fix(completion): use valid zsh _arguments exclusion-group syntax#22727
Sanjays2402 wants to merge 1 commit into
NousResearch:mainfrom
Sanjays2402:fix/issue-22686

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Summary

Replaces the invalid (-X --Y) exclusion groups emitted in the zsh completion script with the canonical (-) form. Long options cannot appear inside _arguments exclusion groups, and the previous output caused zsh to reject the script with _arguments:comparguments: invalid argument: (-h --help){-h,--help}[...], breaking tab completion entirely on zsh.

Repro

source <(hermes completion zsh)
# _arguments:comparguments:327: invalid argument: (-h --help){-h,--help}[Show help and exit]

Changes

  • hermes_cli/completion.py (generate_zsh): emit (-) instead of (-X --Y) so each flag pair is rendered as (-){-X,--Y}'[desc]' (e.g. (-){-h,--help}[Show help and exit]). Fixes the three top-level option specs (-h/--help, -V/--version, -p/--profile).

Testing

  • git diff shows a 3-line minimal change in the zsh emitter.
  • Unit tests in tests/hermes_cli/test_completion.py (the completion-relevant ones) all pass.
  • Manual repro with expect-driven interactive zsh:
    • Before: _arguments:comparguments:327: invalid argument: (-h --help){-h,--help}[Show help and exit] on first TAB.
    • After: completion runs cleanly, no _arguments errors.

Fixes #22686

The generated zsh completion script used `(-h --help)` as the exclusion
group for `_arguments`, which zsh rejects with:

  _arguments:comparguments: invalid argument: (-h --help){-h,--help}[...]

Exclusion groups in `_arguments` cannot contain long options. Use the
canonical `(-)` form (exclude all other options) which correctly
handles flag pairs like `-h`/`--help`.

Fixes NousResearch#22686
@teknium1

teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Merged via salvage PR #22802. salvage cherry-picked your commit (winner among 6 competing PRs for #22686); authorship preserved. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: zsh completion script has invalid _arguments syntax

3 participants