CliktCommand

abstract class CliktCommand(name: String? = null) : CoreCliktCommand

The CliktCommand is the core of command line interfaces in Clikt.

Command line interfaces created by creating a subclass of CliktCommand with properties defined with option and argument. You can then parse argv by calling main, which will take care of printing errors and help to the user. If you want to handle output yourself, you can use parse instead.

Once the command line has been parsed and all the parameters are populated, run is called.

Inheritors

Constructors

Link copied to clipboard
constructor(name: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val BaseCliktCommand<*>.terminal: Terminal

A shortcut for accessing the terminal from the currentContext

Link copied to clipboard

Functions

Link copied to clipboard
open fun aliases(): Map<String, List<String>>
Link copied to clipboard
Link copied to clipboard
open fun commandHelp(context: Context): String
Link copied to clipboard
open fun commandHelpEpilog(context: Context): String
Link copied to clipboard
Link copied to clipboard
fun echo()
fun echo(message: Any?, trailingNewline: Boolean, err: Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun help(context: Context): String
Link copied to clipboard
open fun helpEpilog(context: Context): String
Link copied to clipboard
fun BaseCliktCommand<*>.installMordant(force: Boolean = false)

Set up this command's context to use Mordant for rendering.

Link copied to clipboard
fun issueMessage(message: String)
Link copied to clipboard
fun registerArgument(argument: Argument)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun registerOption(option: GroupableOption)
fun registerOption(option: Option)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun run()
Link copied to clipboard
@JvmName(name = "varargTest")
fun CliktCommand.test(vararg 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
fun CliktCommand.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
fun CliktCommand.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
inline fun <T : BaseCliktCommand<T>> BaseCliktCommand<T>.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, parse: (argv: List<String>) -> Unit): CliktCommandTestResult

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

Link copied to clipboard
open override fun toString(): String