run

class runcommands.run.Run(implementation=None, name=None, description=None, base_command=None, timed=False, data=None, read_config=False, creates=None, sources=None, callbacks=None, arg_config=None, default_args=None, debug=False)[source]
console_script(argv=None, **overrides)[source]

Run the command and then sys.exit().

When exiting isn’t desired (e.g. in tests), wrap the call to this method in a try/except black that catches SystemExit.

implementation(commands_module: arg<None>(-m) = None, config_file: arg<None>(-f) = None, globals_: arg<json_value>() = None, env: arg<None>() = None, version: arg<None>() = None, echo: arg<bool>() = None, environ: arg<None>() = None, info: arg<None>() = False, list_commands: arg<None>() = False, debug: arg<bool>() = None, *, all_argv=(), run_argv=(), command_argv=())[source]

Run one or more commands in succession.

For example, assume the commands local and remote have been defined; the following will run ls first on the local host and then on the remote host:

runcommands local ls remote <host> ls

When a command name is encountered in argv, it will be considered the starting point of the next command unless the previous item in argv was an option like --xyz that expects a value (i.e., it’s not a flag).

To avoid ambiguity when an option value matches a command name, the value can be prepended with a colon to force it to be considered a value and not a command name.