# hazwaz.command module

class hazwaz.command.Command

  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)

    Add argparse arguments to an existing parser.

    Override this method to add arguments to a subcommand.

  main()

    Main code of this subcommand.

    Override this method to implement the actual program.

  name: str | None = 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

  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)

    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)

  commands: Iterable[Command] = ()

    The subcommands: a tuple of `Command` subclasses.

  logformat: str = '%(levelname)s:%(name)s: %(message)s'

    The format passed to logging.Formatter.

  main()

    The main function for a command with no subcommands.

    This default implementation that simply prints the help is good for most cases when there are subcommands and running the bare command doesn’t do anything.

  run()

    Run the command.

    This is the method called to start running the command.

  setup_logging()