eagerOption

fun <T : CliktCommand> T.eagerOption(vararg names: String, help: String = "", hidden: Boolean = false, helpTags: Map<String, String> = emptyMap(), groupName: String? = null, action: OptionTransformContext.() -> Unit): T

Add an eager option to this command that, when invoked, runs action.

Parameters

names

The names that can be used to invoke this option. They must start with a punctuation character.

help

The description of this option, usually a single line.

hidden

Hide this option from help outputs.

helpTags

Extra information about this option to pass to the help formatter

groupName

All options that share a group name will be grouped together in help output.

action

This callback is called when the option is encountered on the command line. If you want to print a message and halt execution normally, you should throw a PrintMessage exception. If you want to exit normally without printing a message, you should throw Abort(error=false).


fun <T : CliktCommand> T.eagerOption(names: Collection<String>, help: String = "", hidden: Boolean = false, helpTags: Map<String, String> = emptyMap(), groupName: String? = null, action: OptionTransformContext.() -> Unit): T

Add an eager option to this command that, when invoked, runs action.

Parameters

names

The names that can be used to invoke this option. They must start with a punctuation character.

help

The description of this option, usually a single line.

hidden

Hide this option from help outputs.

helpTags

Extra information about this option to pass to the help formatter

groupName

All options that share a group name will be grouped together in help output.

action

This callback is called when the option is encountered on the command line. If you want to print a message and halt execution normally, you should throw a PrintMessage exception. If you want to exit normally without printing a message, you should throw ProgramResult(0).