Class implementing common functionality for CLI commands and actions
Variables: |
|
---|
Add custom option requirements
Note : | this method should be overridden to check for required options |
---|
Logs an error and prints it to stderr
Get an option from opts or from the config file Options from opts take precedence.
Parameters: | opt (str) – name of option to get |
---|---|
Returns: | value of the option or None if the option is no present |
Check if option is present
Parameters: | opt (str) – name of option to check |
---|---|
Returns: | True if the option was set, otherwise False |
Main execution of the action This method setups up the parser, parses the arguments, and calls run() in a try/except block, handling RestlibExceptions and general errors
Warning : | this method should only be overridden with care |
---|
Action’s functionality
Note : | override this method to implement the actoin’s functionality |
---|---|
Raises NotImplementedError: | |
if this method is not overridden |
Usage string.
Return type: | str |
---|---|
Returns: | command’s usage string |
Action class representing a single CLI action. All actions should inherit from this class. Inherits from Action.
Variables: | Printer – printer.Printer instance |
---|
Represents a CLI command. It is a simple action with the ability to contain multiple subcommands and actions.
Add custom option requirements
Note : | this method should be overridden to check for required options |
---|
Logs an error and prints it to stderr
Get an option from opts or from the config file Options from opts take precedence.
Parameters: | opt (str) – name of option to get |
---|---|
Returns: | value of the option or None if the option is no present |
Check if option is present
Parameters: | opt (str) – name of option to check |
---|---|
Returns: | True if the option was set, otherwise False |
Action’s functionality
Note : | override this method to implement the actoin’s functionality |
---|---|
Raises NotImplementedError: | |
if this method is not overridden |
Usage string.
Return type: | str |
---|---|
Returns: | command’s usage string |
Add command or action
Parameters: |
|
---|
Raises Exception: | |
---|---|
if the command was not found | |
Returns: | command or action registered under the given name |
Parameters: | name (string) – a name undher which the command/action is registered |
---|