quickie.factories.command
- quickie.factories.command(obj: Callable[[...], Sequence[str] | str]) Command
- quickie.factories.command(*, env: dict[str, str] | None = None, env_file: str | None = None, wd: str | None = None, expected_exit_codes: Sequence[int] | None | UseDefault = USE_DEFAULT, timeout: float | None | UseDefault = USE_DEFAULT, retries: int | UseDefault = USE_DEFAULT, retry_delay: float | UseDefault = USE_DEFAULT, output_mode: OutputModeT | UseDefault = USE_DEFAULT, **kwargs: Unpack[CommonTaskKwargs]) 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:
obj – The function to create the command task from.
kwargs – Common keyword arguments for tasks. See CommonTaskKwargs for more information.
env – The environment variables for the command task.
env_file – Path to a
.envfile. Relative paths are resolved from the quickie tasks root. Values are overridden by env.wd – The working directory for the command task.
expected_exit_codes – Accepted subprocess exit codes for the command.
timeout – Timeout in seconds for each attempt.
Nonemeans no limit.retries – Number of additional attempts after an initial failure.
retry_delay – Seconds to wait between retry attempts.
output_mode – How to handle subprocess output —
"stream"(default),"capture", or"tee". AcceptsOutputModevalues or the equivalent string literals.
- Returns:
The command task class, or, if obj is None, a partial function to be used as a decorator for a function.