quickie.tasks.Task

class quickie.tasks.Task(name=None, *, context: Context)

Base class for all tasks.

__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_before(*args, **kwargs)

Get the tasks to run before this task.

get_cleanup(*args, **kwargs)

Get the tasks to run after this task, even if it fails.

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

after

Tasks to run after this task.

before

Tasks to run before this task.

cleanup

Tasks to run at the end, even if the task, or before or after tasks fail.

condition

The condition to check before running the task.

console

Get the console.

extra_args

Whether to allow extra command line arguments.

private