NoOpCliktCommand

open class NoOpCliktCommand(help: String = "", epilog: String = "", name: String? = null, val invokeWithoutSubcommand: Boolean = false, val printHelpOnEmptyArgs: Boolean = false, val helpTags: Map<String, String> = emptyMap(), autoCompleteEnvvar: String? = "", allowMultipleSubcommands: Boolean = false, hidden: Boolean = false) : CliktCommand

A CliktCommand that has a default implementation of CliktCommand.run that is a no-op.

Constructors

Link copied to clipboard
constructor(help: String = "", epilog: String = "", name: String? = null, invokeWithoutSubcommand: Boolean = false, printHelpOnEmptyArgs: Boolean = false, helpTags: Map<String, String> = emptyMap(), autoCompleteEnvvar: String? = "", allowMultipleSubcommands: Boolean = false, hidden: Boolean = false)

Properties

Link copied to clipboard

The name of this command, used in help output.

Link copied to clipboard

This command's context.

Link copied to clipboard

Extra information about this option to pass to the help formatter.

Link copied to clipboard

Used when this command has subcommands, and this command is called without a subcommand. If true, run will be called. By default, a PrintHelpMessage is thrown instead.

Link copied to clipboard

All messages issued during parsing.

Link copied to clipboard

If this command is called with no values on the command line, print a help message (by throwing PrintHelpMessage) if this is true, otherwise run normally.

Link copied to clipboard
val CliktCommand.terminal: Terminal

A short for accessing the terminal from the currentContext

Functions

Link copied to clipboard
open fun aliases(): Map<String, List<String>>

A list of command aliases.

Link copied to clipboard

Return the parameters that should be sent to the help formatter when this command's getFormattedHelp is called.

Link copied to clipboard
fun CliktCommand.argument(name: String = "", help: String = "", helpTags: Map<String, String> = emptyMap(), completionCandidates: CompletionCandidates? = null): RawArgument

Create a property delegate argument.

Link copied to clipboard
open fun commandHelp(context: Context): String

The help text for this command.

Link copied to clipboard
open fun commandHelpEpilog(context: Context): String

Help text to display at the end of the help output, after any parameters.

Link copied to clipboard
fun echo()

Print a line break to stdout

fun echo(message: Any?, trailingNewline: Boolean = true, err: Boolean = false)

Print the message to the screen.

Link copied to clipboard
fun echoFormattedHelp(error: CliktError? = null)

Echo the string returned by getFormattedHelp.

Link copied to clipboard

Find the closest object of type T, or null

Link copied to clipboard
inline fun <T : Any> CliktCommand.findOrSetObject(crossinline default: () -> T): ReadOnlyProperty<CliktCommand, T>

Find the closest object of type T, setting context.obj if one is not found.

Link copied to clipboard
fun getFormattedHelp(error: CliktError? = null): String?

Return the help string for this command, optionally with an error.

Link copied to clipboard
fun issueMessage(message: String)

Add a message to be printed after parsing

Link copied to clipboard
fun main(argv: Array<out String>)

fun main(argv: List<String>)

Parse the command line and print helpful output if any errors occur.

Link copied to clipboard
fun <T : Any> ParameterHolder.mutuallyExclusiveOptions(option1: OptionDelegate<out T?>, option2: OptionDelegate<out T?>, vararg options: OptionDelegate<out T?>, name: String? = null, help: String? = null): MutuallyExclusiveOptions<T, T?>

Declare a set of two or more mutually exclusive options.

Link copied to clipboard
fun ParameterHolder.option(vararg names: String, help: String = "", metavar: String? = null, hidden: Boolean = false, envvar: String? = null, helpTags: Map<String, String> = emptyMap(), completionCandidates: CompletionCandidates? = null, valueSourceKey: String? = null, eager: Boolean = false): RawOption

Create a property delegate option.

Link copied to clipboard
fun parse(argv: Array<String>, parentContext: Context? = null)

fun parse(argv: List<String>, parentContext: Context? = null)

Parse the command line and throw an exception if parsing fails.

Link copied to clipboard
fun registerArgument(argument: Argument)

Register an argument with this command.

Link copied to clipboard

Get a read-only list of arguments registered in this command (e.g. via registerArgument or an argument delegate)

Link copied to clipboard

Get a read-only list of options registered in this command (e.g. via registerOption or an option delegate)

Link copied to clipboard

Get a read-only list of groups registered in this command (e.g. via registerOptionGroup or an OptionGroup delegate)

Link copied to clipboard

The names of all direct children of this command

Link copied to clipboard

Get a read-only list of commands registered as subcommands of this command.

Link copied to clipboard
open override fun registerOption(option: GroupableOption)

Register an option with this command or group.

fun registerOption(option: Option)

Register an option with this command.

Link copied to clipboard

Register a group with this command.

Link copied to clipboard

Find the closest object of type T, or throw a NullPointerException

Link copied to clipboard
open override fun run()

Perform actions after parsing is complete and this command is invoked.

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): 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): 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): CliktCommandTestResult

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

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