zut.commands.run_command

zut.commands.run_command(handle: ArgumentParser | Callable | dict[str, Any], args: dict | list[str] | None = None, *, default: str | None = None, context_builder: Callable[[dict[str, Any], list[str]], AbstractContextManager | Iterable[AbstractContextManager] | None] | None = None, additional_args_builders: dict[str, Callable[[], Any] | Callable[[dict[str, Any]], Any]] | None = None)

Run a command. - handle may be:

  • An ArgumentParser objects: in this case, run_command will take care of calling parse_args on it.

  • A handle function already parsed before calling this run_command.

  • A dictionnary: this is intended for running Django subcommands directly from the keywork arguments of the Django command’s handle(**option) method. Django-specific options (verbosity, settings, pythonpath, traceback, no_color, force_color and skip_checks) are removed.

  • context_builder: (args: dict, handle_parameters: list[str]) -> context manager, list of context managers or None