parser.command_parser

parser.command_parser(command)

The parser of one subcommand, with every option a front end can render.

build_parser registers the options of mutate itself, but leaves those of the driver local to the driver, which registers them when it runs. A front end that builds a form needs them without running the driver, so this function reads them from the driver (the module is imported here, not when spotregen.parser is). The driver that calls the Claude CLI is not offered to front ends.

Parameters

Name Type Description Default
command str A subcommand of build_parser, or "local". required

Returns

Name Type Description
argparse.ArgumentParser argparse.ArgumentParser: The parser of the subcommand, with its positional arguments and options.

Raises

Name Type Description
ValueError If command is not a subcommand, or is the driver that front ends do not offer.

Examples

from spotregen.parser import command_parser

for command in ("mutate", "local"):
    flags = [a.option_strings[-1] for a in command_parser(command)._actions
             if a.option_strings and a.dest != "help"]
    print(command, flags[:4])
mutate ['--max', '--timeout', '--python', '--out']
local ['--model', '--endpoint', '--allow', '--attempts']