quickie.script
- quickie.script(fn: Callable[[...], str]) type[Script]
- quickie.script(*, name: str | None = None, executable: 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[Script]
Create a script from a function.
@script(name="hello", bind=True) def hello_script(task): return "echo Hello, script!" @script def hello_world(): """Docstring will be used as help text.""" return "echo Hello, world!"
- Parameters:
fn – The function to create the script from.
name – The name of the script.
extra_args – If the script accepts extra arguments.
bind – If true, the first parameter of the function will be the task class instance.
condition – The condition to check before running the script.
before – The tasks to run before the script.
after – The tasks to run after the script.
cleanup – The tasks to run after the script, even if it fails.
env – The environment variables for the script.
cwd – The working directory for the script.
- Returns:
The task class, or, if fn is None, a partial function to be used as a decorator for a function.