INNER CODE UNIT · Python
_resolve_callback
CaddyGlow/ccproxy-api · ccproxy/cli/main.py:158
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
# attributes commonly present on Typer instances.
for idx, part in enumerate(parts):
if current_app is None:
return None
# Try commands at this level
cmds = getattr(current_app, "registered_commands", [])