quickie.command

quickie.command(fn: Callable[[...], Sequence[str] | str]) type[Command]
quickie.command(*, name: str | None = None, extra_args: bool | None = False, bind: bool = False, condition: BaseCondition | None = None, before: Sequence[Any] | None = None, after: Sequence[Any] | None = None, cleanup: Sequence[Any] | None = None, env: dict[str, str] | None = None, cwd: str | None = None) PartialReturnType[Command]

Create a command task from a function.

@command(name="hello", bind=True)
def run_program(task):
    return ["program", "arg1", "arg2"]

@command
def hello_world():
    """Docstring will be used as help text."""
    return ["program", "arg1", "arg2"]
Parameters:
  • fn – The function to create the command task from.

  • name – The name of the command task.

  • extra_args – If the command task accepts extra arguments.

  • bind – If true, the first parameter of the function will be the task class instance.

  • before – The tasks to run before the command task.

  • after – The tasks to run after the command task.

  • cleanup – The tasks to run after the command task, even if it fails.

  • env – The environment variables for the command task.

  • cwd – The working directory for the command task.

Returns:

The command task class, or, if fn is None, a partial function to be used as a decorator for a function.