INNER CODE UNIT · Python
_first_root_command
evalstate/fast-agent · src/fast_agent/cli/main.py:141
def _first_root_command(args: list[str]) -> str | None:
index = 0
while index < len(args):
arg = args[index]
if arg == "--":
return args[index + 1] if index + 1 < len(args) else None
if arg in {"--home"}:
index += 2
continue
if arg.startswith("--home="):
index += 1
continue
if arg.startswith("-") and arg != "-":
index += 1
continue
return arg
return None