mopidy.commands
— Commands API
- class mopidy.commands.Command None [source]
Command parser and runner for building trees of commands.
This class provides a wraper around
argparse.ArgumentParser
for handling this type of command line application in a better way than argparse’s own sub-parser handling.- add_argument(*args, **kwargs) None [source]
Add an argument to the parser.
This method takes all the same arguments as the
argparse.ArgumentParser
version of this method.- Return type:
- exit(status_code=0, message=None, usage=None) NoReturn [source]
Optionally print a message and exit.
- Return type:
- parse(args, prog=None) Namespace [source]
Parse command line arguments.
Will recursively parse commands until a final parser is found or an error occurs. In the case of errors we will print a message and exit. Otherwise, any overrides are applied and the current parser stored in the command attribute of the return value.