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).
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""``hermes whatsapp`` subcommand parser.
|
|
|
|
Extracted verbatim from ``hermes_cli/main.py:main()`` (god-file Phase 2).
|
|
Handler injected to avoid importing ``main``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Callable
|
|
|
|
|
|
def build_whatsapp_parser(subparsers, *, cmd_whatsapp: Callable) -> None:
|
|
"""Attach the ``whatsapp`` subcommand to ``subparsers``."""
|
|
# =========================================================================
|
|
# whatsapp command
|
|
# =========================================================================
|
|
whatsapp_parser = subparsers.add_parser(
|
|
"whatsapp",
|
|
help="Set up WhatsApp integration",
|
|
description="Configure WhatsApp and pair via QR code",
|
|
)
|
|
whatsapp_parser.set_defaults(func=cmd_whatsapp)
|
|
|
|
|
|
def build_whatsapp_cloud_parser(subparsers, *, cmd_whatsapp_cloud: Callable) -> None:
|
|
"""Attach the ``whatsapp-cloud`` subcommand (official Meta Cloud API)."""
|
|
whatsapp_cloud_parser = subparsers.add_parser(
|
|
"whatsapp-cloud",
|
|
help="Set up WhatsApp Business Cloud API integration",
|
|
description=(
|
|
"Configure the official Meta WhatsApp Business Cloud API "
|
|
"adapter (Business account required, public webhook URL "
|
|
"required). Distinct from `hermes whatsapp` which sets up "
|
|
"the Baileys bridge for personal accounts."
|
|
),
|
|
)
|
|
whatsapp_cloud_parser.set_defaults(func=cmd_whatsapp_cloud)
|