Overview of Cappa CLI patterns
mainCappa is a declarative command line parsing library that uses runtime type inspection to infer CLI argument behavior, generate help text, and provide dynamic completion. It offers four primary styles of CLI declaration:
- Classes: Fields in a class correspond to CLI arguments or subcommands.
- Functions: Arguments in a function correspond to CLI arguments.
- Methods: Class fields correspond to parent arguments, while methods act as subcommands.
- Imperative Construction: Manually building the CLI structure using
cappa.Commandinstead of relying on inference.
Cappa supports two execution modes:
parse: Returns an instance of the input structure (similar toargparse).invoke: Calls a function based on the selected subcommand (similar toclickortyper).