CLI entry point for terok-sandbox.
Built from the command registry in :mod:terok_sandbox.commands.
No command logic lives here — just argument wiring and dispatch.
main()
Entry point for the terok-sandbox command.
Source code in src/terok_sandbox/cli.py
| def main() -> None:
"""Entry point for the ``terok-sandbox`` command."""
parser = argparse.ArgumentParser(
prog="terok-sandbox",
description="Hardened Podman container runtime with shield firewall and git gate",
)
parser.add_argument("--version", action="version", version=f"terok-sandbox {__version__}")
sub = parser.add_subparsers()
# -- shield --
shield_p = sub.add_parser("shield", help="Egress firewall management")
shield_sub = shield_p.add_subparsers()
for cmd in SHIELD_COMMANDS:
_wire_command(shield_sub, cmd)
shield_p.set_defaults(_group_help=shield_p)
# -- gate --
gate_p = sub.add_parser("gate", help="Git gate server management")
gate_sub = gate_p.add_subparsers()
for cmd in GATE_COMMANDS:
_wire_command(gate_sub, cmd)
gate_p.set_defaults(_group_help=gate_p)
# -- proxy --
proxy_p = sub.add_parser("proxy", help="Credential proxy management")
proxy_sub = proxy_p.add_subparsers()
for cmd in PROXY_COMMANDS:
_wire_command(proxy_sub, cmd)
proxy_p.set_defaults(_group_help=proxy_p)
# -- ssh --
ssh_p = sub.add_parser("ssh", help="SSH keypair management")
ssh_sub = ssh_p.add_subparsers()
for cmd in SSH_COMMANDS:
_wire_command(ssh_sub, cmd)
ssh_p.set_defaults(_group_help=ssh_p)
# -- doctor --
for cmd in DOCTOR_COMMANDS:
_wire_command(sub, cmd)
args = parser.parse_args()
if hasattr(args, "_cmd"):
_dispatch(args)
elif hasattr(args, "_group_help"):
args._group_help.print_help()
else:
parser.print_help()
raise SystemExit(1)
|