quickie.tasks.Command
- class quickie.tasks.Command(name=None, *, context: Context)
Base class for tasks that run a binary.
- __init__(name=None, *, context: Context)
Initialize the task.
This is usually not needed, unless you want to call the task directly.
- Parameters:
name – The name of the task. Usually the name it was invoked with. Defaults to the class name.
context – The context of the task. To avoid side effects, a shallow copy is made.
Methods
__init__([name])Initialize the task.
add_args(parser)Add arguments to the parser.
condition_passes(*args, **kwargs)Check the condition before running the task.
confirm(prompt[, default])Prompt the user for confirmation.
full_run(*args, **kwargs)Call the task, including before, after, and cleanup tasks.
get_after(*args, **kwargs)Get the tasks to run after this task.
get_args(*args, **kwargs)Get the program arguments.
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_cwd(*args, **kwargs)Get the current working directory.
get_env(*args, **kwargs)Get the environment.
get_help()Get the help message of the task.
get_parser(**kwargs)Get the parser for the task.
get_short_help()Get the short help message of the task.
parse_and_run(args)Parse arguments and run the task.
parse_args(*, parser, args, extra_args)Parse arguments.
print(*args, **kwargs)Print a line.
print_error(*args, **kwargs)Print an error message.
print_info(*args, **kwargs)Print an info message.
print_success(*args, **kwargs)Print a success message.
print_warning(*args, **kwargs)Print a warning message.
prompt(prompt, *[, password, choices, ...])Prompt the user for input.
run(*args, **kwargs)Runs work related to the task, excluding before, after, and cleanup tasks.
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.
Attributes
afterTasks to run after this task.
argsThe program arguments.
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.
conditionThe condition to check before running the task.
consoleGet the console.
cwdThe current working directory.
envThe environment.
extra_argsWhether to allow extra command line arguments.
private