b81ab901f3
moa, fallback, worktree, browser, secrets, egress, migrate, whatsapp-cloud, checkpoints, bundles, curator, pets, journey, computer-use, sessions and completion each become a build_<group>_parser() builder. Closure handlers that only closed over their own parser moved verbatim; sessions/completion take the handler by injection. --help/usage/defaults byte-identical for all 399 parsers in the tree (in-process dump before/after).
26 lines
834 B
Python
26 lines
834 B
Python
"""``hermes completion`` subcommand parser.
|
|
|
|
Extracted from ``hermes_cli/main.py:main()`` (god-file Phase 2 follow-up).
|
|
Handlers are injected or imported lazily so this module never imports ``main``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Callable
|
|
|
|
|
|
def build_completion_parser(subparsers, *, cmd_completion: Callable, parser) -> None:
|
|
"""Attach the ``completion`` subcommand to ``subparsers``."""
|
|
completion_parser = subparsers.add_parser(
|
|
"completion",
|
|
help="Print shell completion script (bash, zsh, or fish)",
|
|
)
|
|
completion_parser.add_argument(
|
|
"shell",
|
|
nargs="?",
|
|
default="bash",
|
|
choices=["bash", "zsh", "fish"],
|
|
help="Shell type (default: bash)",
|
|
)
|
|
completion_parser.set_defaults(func=lambda args: cmd_completion(args, parser))
|