MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _parse_flags

Function _parse_flags

uncommon_route/cli.py:372–394  ·  view source on GitHub ↗

Parse flags from args. known_flags maps flag name -> has_value.

(args: list[str], known_flags: dict[str, bool])

Source from the content-addressed store, hash-verified

370
371
372def _parse_flags(args: list[str], known_flags: dict[str, bool]) -> tuple[dict[str, str | bool], list[str]]:
373 """Parse flags from args. known_flags maps flag name -> has_value."""
374 flags: dict[str, str | bool] = {}
375 rest: list[str] = []
376 i = 0
377 while i < len(args):
378 arg = args[i]
379 clean = arg.lstrip("-")
380 if arg.startswith("--") and clean in known_flags:
381 if known_flags[clean]:
382 if i + 1 < len(args):
383 flags[clean] = args[i + 1]
384 i += 2
385 else:
386 print(f"Error: {arg} requires a value", file=sys.stderr)
387 sys.exit(1)
388 else:
389 flags[clean] = True
390 i += 1
391 else:
392 rest.append(arg)
393 i += 1
394 return flags, rest
395
396
397_TIER_ORDER = ["SIMPLE", "MEDIUM", "COMPLEX"]

Callers 12

_cmd_routeFunction · 0.85
_cmd_debugFunction · 0.85
_cmd_serveFunction · 0.85
_cmd_logsFunction · 0.85
_cmd_initFunction · 0.85
_cmd_supportFunction · 0.85
_cmd_spendFunction · 0.85
_cmd_configFunction · 0.85
_cmd_statsFunction · 0.85
_setup_claude_codeFunction · 0.85
_setup_codexFunction · 0.85
_setup_openaiFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected