INNER CODE UNIT · Python

_extend_command_with_arguments

CaddyGlow/ccproxy-api · ccproxy/cli/main.py:152

def _extend_command_with_arguments(
    app: typer.Typer, target_name: str, pairs: list[tuple[str, CliArgumentSpec]]
) -> None:
    """Extend an existing command with multiple new arguments at once."""
    try:
        # Utility: resolve a command callback by dotted path, supporting subcommands
        def _resolve_callback(root_app: typer.Typer, dotted: str) -> Any:
            parts = dotted.split()
            # Allow both space-separated or colon-separated ("auth login")
            if len(parts) == 1 and (":" in dotted or "/" in dotted):
                # normalize common separators
                dotted_norm = dotted.replace(":", " ").replace("/", " ")
                parts = dotted_norm.split()

            current_app: typer.Typer | None = root_app
            callback = None

            # Typer API does not expose a stable public registry; we rely on

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…