quickie.tasks.Command
- class quickie.tasks.Command(*args, binary: str | None = None, cmd_args: Sequence[str] | None = None, **kwargs)
Base class for tasks that run a binary.
- __init__(*args, binary: str | None = None, cmd_args: Sequence[str] | None = None, **kwargs)
Initialize the task.
- Parameters:
args – Task instance arguments.
kwargs – Task instance keyword arguments.
Methods
__init__(*args[, binary, cmd_args])Initialize the task.
add_args(parser)Add arguments to the parser.
condition_passes(*args, **kwargs)Check the condition before running the task.
full_run(*args, **kwargs)Execute the full task lifecycle and return the result of
run().get_after(*args, **kwargs)Get the tasks to run after this task.
get_before(*args, **kwargs)Get the tasks to run before this task.
get_binary(*args, **kwargs)Get the name or path of the program to run.
get_cleanup(*args, **kwargs)Get the tasks to run after this task, even if it fails.
get_cmd(*args, **kwargs)Get the full command to run, as a sequence.
get_cmd_args(*args, **kwargs)Get the program arguments.
get_env(*args, **kwargs)Get the environment.
get_expected_exit_codes(*args, **kwargs)Get accepted subprocess exit codes.
get_help()Get the help message of the task.
get_parser(*[, name])Get the parser for the task.
get_plain_usage()Return the usage string without ANSI escape sequences.
get_retries()Get the number of additional retry attempts.
get_retry_delay()Get the seconds to wait between retry attempts.
get_short_help()Get the short help message of the task.
get_timeout()Get the subprocess timeout in seconds.
get_wd(*args, **kwargs)Get the working directory.
log_task_execution(*args, **kwargs)Log information about the task execution.
log_task_execution_details(program, args)Log details about the task execution.
parse_and_run(args)Parse arguments and run the task.
parse_args(*, parser, args, extra_args)Parse arguments.
run(*args, **kwargs)Run the main work of this task.
run_after(*args, **kwargs)Run the tasks after this task.
run_before(*args, **kwargs)Run the tasks before this task.
run_cleanup(*args, **kwargs)Run the tasks after this task, even if it fails.
split_cmd_args(args)Split the arguments string into a list of arguments.
to_info_dict(cwd)Serialise task metadata to a plain dict suitable for JSON output.
validate_exit_code(*, return_code, command, ...)Validate the subprocess return code.
Attributes
afterTasks to run after this task.
argsArguments for the task.
beforeTasks to run before this task.
binaryThe name or path of the program to run.
cleanupTasks to run at the end, even if the task, or before or after tasks fail.
cmd_argsThe program arguments.
conditionThe condition to check before running the task.
envThe environment.
env_filePath to a
.envfile whose variables are merged into the environment.expected_exit_codesAccepted subprocess exit codes.
extra_argsWhether to allow extra command line arguments.
output_modeControls how subprocess output is handled.
parserParser for the task.
retriesNumber of additional attempts after an initial failure.
retry_delaySeconds to wait between retry attempts.
timeoutTimeout in seconds for each subprocess attempt.
wdThe current working directory.