doot.control.main

Type Aliases

DataSource

Classes

LoadingController

mixin for triggering full loading

CLIController

mixin for cli arg processing

CmdController

mixin for actually running a command

ShutdownController

mixin for cleaning up on and shutting down doot

ErrorHandlers

Mixin for handling different errors of doot

DootMain

doot.main and the associated exit handlers

Module Contents

doot.control.main.DataSource: TypeAlias = dict | ChainGuard
class doot.control.main.LoadingController[source]

mixin for triggering full loading

DM: TypeAlias = Main_p
_version_template: str
load(obj: DM) None[source]
Parameters:

obj (DM)

Return type:

None

update_command_aliases(obj: DM) None[source]

Read settings.commands.* and register aliases

commands use doot.config.settings.commands.NAME, and within that, ‘aliases’ gives a dict of {alias=[args]}

eg: commands.list.aliases.acts = [’–actions’] .. aliases ‘doot acts’ .. to equiv of ‘doot list –actions’

Parameters:

obj (DM)

Return type:

None

class doot.control.main.CLIController[source]

mixin for cli arg processing

DM: TypeAlias = DootMain
parse_args(
obj: DM,
*,
override: jgdv.Maybe[list] = None,
) None[source]

use loaded cmd and tasks to parse sys.argv

Parameters:
  • obj (DM)

  • override (jgdv.Maybe[list])

Return type:

None

_load_cli_parser(
obj: DM,
*,
target: str = 'default',
) jgdv.cli.ParseMachine[source]
Parameters:
  • obj (DM)

  • target (str)

Return type:

jgdv.cli.ParseMachine

_unalias_raw_args(obj: DM) list[str][source]

replaces aliases with their full command args.

Just a simple, literal, find and replace

Parameters:

obj (DM)

Return type:

list[str]

_construct_implicits() dict[str, list[str]][source]
Return type:

dict[str, list[str]]

_map_subcmd_constraints() list[tuple[tuple[str, Ellipsis], jgdv.cli.ParamSource_p]][source]
Return type:

list[tuple[tuple[str, Ellipsis], jgdv.cli.ParamSource_p]]

class doot.control.main.CmdController[source]

mixin for actually running a command

DM: TypeAlias = DootMain
prepare(obj: DM) None[source]
Parameters:

obj (DM)

Return type:

None

run_cmds(obj: DM) None[source]
Parameters:

obj (DM)

Return type:

None

get_cmd_instance(
obj: DM,
*,
cmd: str,
) doot.cmds._interface.Command_p[source]

Uses the full command name to get the instance of the command

Parameters:
  • obj (DM)

  • cmd (str)

Return type:

doot.cmds._interface.Command_p

run_cmd(
*,
idx: int,
cmd: doot.cmds._interface.Command_p,
) int[source]

The method run to trigger a doot workflow

Parameters:
Return type:

int

class doot.control.main.ShutdownController[source]

mixin for cleaning up on and shutting down doot

DM: TypeAlias = DootMain
prepare(obj: DM) None[source]
Parameters:

obj (DM)

Return type:

None

shutdown(obj: DM) None[source]

Doot has finished, report on what was done and how doot finished

Parameters:

obj (DM)

Return type:

None

install_handler(obj: DM) None[source]

Install an exit handler

Parameters:

obj (DM)

Return type:

None

announce_exit(message: str) None[source]

triggers speech synthesis on exiting doot

Parameters:

message (str)

Return type:

None

record_defaulted_config_values() None[source]
Return type:

None

class doot.control.main.ErrorHandlers[source]

Mixin for handling different errors of doot

DM: TypeAlias = DootMain
discriminate_exit(
obj: DootMain,
err: Exception,
) int[source]
Parameters:
Return type:

int

_early_exit(
err: doot.errors.EarlyExit | doot.errors.Interrupt | bdb.BdbQuit,
) int[source]
Parameters:

err (doot.errors.EarlyExit | doot.errors.Interrupt | bdb.BdbQuit)

Return type:

int

_missing_config_exit(
obj: DootMain,
err: doot.errors.MissingConfigError,
) int[source]
Parameters:
  • obj (DootMain)

  • err (doot.errors.MissingConfigError)

Return type:

int

_config_error_exit(
err: doot.errors.ConfigError,
) int[source]
Parameters:

err (doot.errors.ConfigError)

Return type:

int

_task_failed_exit(
err: doot.errors.TaskError,
) int[source]
Parameters:

err (doot.errors.TaskError)

Return type:

int

_bad_state_exit(
err: doot.errors.StateError,
) int[source]
Parameters:

err (doot.errors.StateError)

Return type:

int

_bad_struct_exit(
err: doot.errors.StructLoadError,
) int[source]
Parameters:

err (doot.errors.StructLoadError)

Return type:

int

_tracking_exit(
err: doot.errors.TrackingError,
) int[source]
Parameters:

err (doot.errors.TrackingError)

Return type:

int

_backend_exit(
err: doot.errors.BackendError,
) int[source]
Parameters:

err (doot.errors.BackendError)

Return type:

int

_frontend_exit(
err: doot.errors.FrontendError,
) int[source]
Parameters:

err (doot.errors.FrontendError)

Return type:

int

_misc_doot_exit(err: doot.errors.DootError) int[source]
Parameters:

err (doot.errors.DootError)

Return type:

int

_not_implemented_exit(
err: NotImplementedError,
) int[source]
Parameters:

err (NotImplementedError)

Return type:

int

python_exit(err: Exception) int[source]
Parameters:

err (Exception)

Return type:

int

class doot.control.main.DootMain(*, cli_args: jgdv.Maybe[list] = None)[source]

Bases: jgdv.cli.ParamSpecMaker_m

doot.main and the associated exit handlers

Error’s if doot hasn’t got an overlord (aliased as the doot package)

loads values from the overlord config, sets up runtime plugin system

Parameters:

cli_args (jgdv.Maybe[list])

_loading: ClassVar[LoadingController]
_cli: ClassVar[CLIController]
_cmd: ClassVar[CmdController]
_shutdown: ClassVar[ShutdownController]
_err: ClassVar[ErrorHandlers]
result_code: int
bin_name: str
prog_name: str
current_cmd: jgdv.Maybe[doot.cmds._interface.Command_p]
_errored: jgdv.Maybe[Exception]
_help_txt = ('A Toml Specified Task Runner',)
parser = None
log_config
property name: str[source]
Return type:

str

param_specs() list[jgdv.cli.param_spec.ParamSpec][source]

The cli parameters of the main doot program.

Return type:

list[jgdv.cli.param_spec.ParamSpec]

help() str[source]
Return type:

str

setup_logging() None[source]
Return type:

None

handle_cli_args() jgdv.Maybe[int][source]

Overlord specific cli arg responses. Modifies: - verbosity, - print version - header suppression - help printing - debugger entry

return an int to give an override result code

Return type:

jgdv.Maybe[int]