fix: preserve profile name completion in dynamic shell completion

The dynamic parser walker from the contributor's commit lost the profile
name tab-completion that existed in the old static generators. This adds
it back for all three shells:

- Bash: _hermes_profiles() helper, -p/--profile completion, profile
  action→name completion (use/delete/show/alias/rename/export)
- Zsh: _hermes_profiles() function, -p/--profile argument spec, profile
  action case with name completion
- Fish: __hermes_profiles function, -s p -l profile flag, profile action
  completions

Also removes the dead fallback path in cmd_completion() that imported
the old static generators from profiles.py (parser is always available
via the lambda wiring) and adds 11 regression-prevention tests for
profile completion.
This commit is contained in:
Teknium
2026-04-14 10:30:43 -07:00
committed by Teknium
parent c95b1c5096
commit b867171291
3 changed files with 196 additions and 30 deletions

View File

@@ -4428,20 +4428,12 @@ def cmd_completion(args, parser=None):
"""Print shell completion script."""
from hermes_cli.completion import generate_bash, generate_zsh, generate_fish
shell = getattr(args, "shell", "bash")
if parser is not None:
if shell == "zsh":
print(generate_zsh(parser))
elif shell == "fish":
print(generate_fish(parser))
else:
print(generate_bash(parser))
if shell == "zsh":
print(generate_zsh(parser))
elif shell == "fish":
print(generate_fish(parser))
else:
# Fallback: parser not available (e.g. called outside main())
from hermes_cli.profiles import generate_bash_completion, generate_zsh_completion
if shell == "zsh":
print(generate_zsh_completion())
else:
print(generate_bash_completion())
print(generate_bash(parser))
def cmd_logs(args):