App#
- class cli_interview_kit.App[source]#
Bases:
FrozenModelA command-line app built from command declarations.
- Attributes:
- namestr
Program name.
- descriptionstr
Top-level help.
- versionstr
What
--versionprints after the name.- commandstuple[Command, …]
The top-level commands.
- expected_errorstuple[type[Exception], …]
Further exception types whose message is reported like a
CliError, for failures the app’s own libraries raise.
Methods
main([argv])Run the command
argvselects and return the exit code.Return the argument parser for every declared command.
- main(argv: Sequence[str] | None = None) int[source]#
Run the command
argvselects and return the exit code.- Parameters:
- argvSequence[str] | None
The arguments after the program name;
sys.argv[1:]if omitted.
- Returns:
- int
The exit code: 0 on success, 1 on a failure, 130 when interrupted.
- Raises:
- SystemExit
A usage error (an unknown flag, a bad choice) exits with status 2, as argparse does.
- build_parser() ArgumentParser[source]#
Return the argument parser for every declared command.
- Returns:
- ArgumentParser
The parser, with
--version,--debugand one subparser per command.