tomwer.utils.Launcher#

class tomwer.utils.Launcher(prog=None, usage=None, description=None, epilog=None, version=None)#

Manage launch of module.

Provides an API to describe available commands and feature to display help and execute the commands.

add_command(name=None, module_name=None, description=None, command=None)#

Add a command to the launcher.

See also LauncherCommand.

Parameters:
  • name (str) – Name of the command

  • module_name (str) – Module to execute

  • description (str) – Description of the command

  • command (LauncherCommand) – A LauncherCommand

execute(argv=None)#

Execute the launcher.

Parameters:

argv (list[str]) – The list of arguments (the first one is the name of the application)

Return type:

int

Returns:

The execution status

execute_help(argv)#

Execute the help command.

Parameters:

argv (list[str]) – The list of arguments (the first one is the name of the application with the help command)

Return type:

int

Returns:

The execution status

print_help()#

Print the help to stdout.