hazwaz.command module¶
- class hazwaz.command.Command[source]¶
Bases:
object
A subcommand to a MainCommand.
Every subcommand of your script will be a subclass of this, added to the
MainCommand.subcommands
.- add_arguments(parser: ArgumentParser)[source]¶
Add argparse arguments to an existing parser.
Override this method to add arguments to a subcommand.
- name: Optional[str] = None¶
The name used to call this subcommand from the command line.
If this property is none, the default is the name of the class set to lowercase.
- class hazwaz.command.MainCommand[source]¶
Bases:
object
The main class for a command line command.
Your script will have to subclass this once, instantiate and run its
run()
e.g. as:class MyCommand(MainCommand): """ A description that will be used in the help. """ if __name__ == "__main__": MyCommand().run()
- add_arguments(parser: ArgumentParser)[source]¶
Add argparse arguments to an existing parser.
If you need to override this method, you probably want to call super().add_arguments(parser) to add the default arguments.
- coloredlogs: bool = True¶
Whether coloredlogs is used (if available)
- logformat: str = '%(levelname)s:%(name)s: %(message)s'¶
The format passed to logging.Formatter.