_shared.py 1.1 KB

1234567891011121314151617181920212223242526
  1. """Shared argparse helpers for the ``hermes_cli/subcommands/*`` builders.
  2. Import-cycle-free (no ``main`` import); ``main.py`` re-exports for compatibility.
  3. """
  4. from __future__ import annotations
  5. import argparse
  6. def add_accept_hooks_flag(parser: argparse.ArgumentParser) -> None:
  7. """Attach ``--accept-hooks`` (shared by every agent subparser so it works in any position)."""
  8. parser.add_argument(
  9. "--accept-hooks", action="store_true", default=argparse.SUPPRESS,
  10. help="Auto-approve unseen shell hooks without a TTY prompt "
  11. "(equivalent to HERMES_ACCEPT_HOOKS=1 / hooks_auto_accept: true).")
  12. def add_yes_flag(parser: argparse.ArgumentParser, help: str = "Skip confirmation prompt") -> None:
  13. """Attach ``--yes/-y`` (store_true) with the given help text."""
  14. parser.add_argument("--yes", "-y", action="store_true", help=help)
  15. def add_json_flag(parser: argparse.ArgumentParser, help: str) -> None:
  16. """Attach ``--json`` (store_true) with the given help text."""
  17. parser.add_argument("--json", action="store_true", help=help)