earwax.cmd.main module¶
The Earwax command line utility.
This module provides the cmd_main
function, and all sub commands.
To run the client:
- Make sure Earwax and all its dependencies are up to date.
- In the folder where you wish to work, type
earwax
. This is a standard - command line utility, which should provide enough of its own help that no replication is required in this document.
- In the folder where you wish to work, type
NOTE: At the time of writing, only the earwax story
command actually does
all that much that is useful. Everything else needs fleshing out.
If you want to create more subcommands, add them in the subcommands directory,
then register them with the subcommand()
method.
-
earwax.cmd.main.
add_help
(subparser: argparse._SubParsersAction) → argparse.ArgumentParser¶ Add a help command to any subcommand.
-
earwax.cmd.main.
add_subcommands
(_parser: argparse.ArgumentParser) → argparse._SubParsersAction¶ Add subcommands to any parser.
Parameters: _parser – The parser to add subcommands to.
-
earwax.cmd.main.
cmd_help
(subcommand: argparse._SubParsersAction) → Callable[[argparse.Namespace], None]¶ Return a command function that will show all subcommands.
-
earwax.cmd.main.
cmd_main
() → None¶ Run the earwax client.
-
earwax.cmd.main.
subcommand
(name: str, func: Callable[[argparse.Namespace], None], subparser: argparse._SubParsersAction, formatter_class: Type[argparse.HelpFormatter] = <class 'argparse.ArgumentDefaultsHelpFormatter'>, **kwargs) → argparse.ArgumentParser¶ Add a subcommand to the argument parser.
Parameters: - name – The name of the new command.
- func – The function that will be called when this subcommand is used.
- subparser – The parser to add the sub command to.
- kwargs – Keyword arguments to be passed to
commands.add_parser
.