test

fun <T> ChainedCliktCommand<T>.test(argv: String, initial: T, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult
fun <T> ChainedCliktCommand<T>.test(argv: Array<String>, initial: T, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult
fun <T> ChainedCliktCommand<T>.test(argv: List<String>, initial: T, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24): CliktCommandTestResult

Test this command, returning a result that captures the output and result status code.

Note that only output printed with echo will be captured. Anything printed with print or println is not.

Parameters

argv

The command line to send to the command

stdin

Content of stdin that will be read by prompt options. Multiple inputs should be separated by \n.

envvars

A map of environment variable name to value for envvars that can be read by the command

includeSystemEnvvars

Set to true to include the environment variables from the system in addition to those defined in envvars

ansiLevel

Defaults to no colored output; set to AnsiLevel.TRUECOLOR to include ANSI codes in the output.

width

The width of the terminal, used to wrap text

height

The height of the terminal


suspend fun SuspendingCliktCommand.test(argv: String, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24, hyperlinks: Boolean = ansiLevel != AnsiLevel.NONE, outputInteractive: Boolean = ansiLevel != AnsiLevel.NONE, inputInteractive: Boolean = ansiLevel != AnsiLevel.NONE): CliktCommandTestResult
suspend fun SuspendingCliktCommand.test(argv: Array<String>, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24, hyperlinks: Boolean = ansiLevel != AnsiLevel.NONE, outputInteractive: Boolean = ansiLevel != AnsiLevel.NONE, inputInteractive: Boolean = ansiLevel != AnsiLevel.NONE): CliktCommandTestResult
suspend fun SuspendingCliktCommand.test(argv: List<String>, stdin: String = "", envvars: Map<String, String> = emptyMap(), includeSystemEnvvars: Boolean = false, ansiLevel: AnsiLevel = AnsiLevel.NONE, width: Int = 79, height: Int = 24, hyperlinks: Boolean = ansiLevel != AnsiLevel.NONE, outputInteractive: Boolean = ansiLevel != AnsiLevel.NONE, inputInteractive: Boolean = ansiLevel != AnsiLevel.NONE): CliktCommandTestResult

Test this command, returning a result that captures the output and result status code.

Note that only output printed with echo will be captured. Anything printed with print or println is not.

Parameters

argv

The command line to send to the command

stdin

Content of stdin that will be read by prompt options. Multiple inputs should be separated by \n.

envvars

A map of environment variable name to value for envvars that can be read by the command

includeSystemEnvvars

Set to true to include the environment variables from the system in addition to those defined in envvars

ansiLevel

Defaults to no colored output; set to AnsiLevel.TRUECOLOR to include ANSI codes in the output.

width

The width of the terminal, used to wrap text

height

The height of the terminal

hyperlinks

Whether to enable hyperlink support in the terminal

outputInteractive

Whether the output is interactive

inputInteractive

Whether the input is interactive