class CliRunner:
Parameters | |
charset | the character set for the input and output data. |
env | a dictionary with environment variables for overriding. |
echo_stdin | if this is set to True , then reading from stdin writes
to stdout. This is useful for showing examples in
some circumstances. Note that regular prompts
will automatically echo the input. |
mix_stderr | if this is set to False , then stdout and stderr are
preserved as independent streams. This is useful for
Unix-philosophy apps that have predictable stdout and
noisy stderr, such that each may be measured
independently |
Method | get_default_prog_name |
Given a command object it will return the default program name for it. The default is the name attribute or "root" if not set. |
Method | invoke |
No summary |
Method | isolated_filesystem |
No summary |
Method | isolation |
No summary |
Method | make_env |
Returns the environment overrides for invoking a script. |
Method | __init__ |
Undocumented |
Instance Variable | charset |
Undocumented |
Instance Variable | echo_stdin |
Undocumented |
Instance Variable | env |
Undocumented |
Instance Variable | mix_stderr |
Undocumented |
name
attribute or "root" if not
set.Parameters | |
cli:BaseCommand | Undocumented |
Returns | |
str | Undocumented |
Invokes a command in an isolated environment. The arguments are
forwarded directly to the command line script, the extra
keyword
arguments are passed to the ~clickpkg.Command.main
function of
the command.
This returns a Result
object.
Parameters | |
cli:BaseCommand | the command to invoke |
args:t.Optional[ | the arguments to invoke. It may be given as an iterable
or a string. When given as string it will be interpreted
as a Unix shell command. More details at
shlex.split . |
input:t.Optional[ | the input data for sys.stdin . |
env:t.Optional[ | the environment overrides. |
catch_exceptions:bool | Whether to catch any other exceptions than SystemExit. |
color:bool | whether the output should contain color codes. The application can still override this explicitly. |
**extra:t.Any | the keyword arguments to pass to main . |
Returns | |
Result | Undocumented |
A context manager that creates a temporary directory and changes the current working directory to it. This isolates tests that affect the contents of the CWD to prevent them from interfering with each other.
Parameters | |
temp_dir:t.Optional[ | Create the temporary directory under this directory. If given, the created directory is not removed when exiting. |
Returns | |
t.Iterator[ | Undocumented |
A context manager that sets up the isolation for invoking of a
command line tool. This sets up stdin with the given input data
and os.environ
with the overrides from the given dictionary.
This also rebinds some internals in Click to be mocked (like the
prompt functionality).
This is automatically done in the invoke
method.
Parameters | |
input:t.Optional[ | the input stream to put into sys.stdin. |
env:t.Optional[ | the environment overrides as dictionary. |
color:bool | whether the output should contain color codes. The application can still override this explicitly. |
Returns | |
t.Iterator[ | Undocumented |
Parameters | |
overrides:t.Optional[ | Undocumented |
Returns | |
t.Mapping[ | Undocumented |