clikt / com.github.ajalt.clikt.parameters.options / EagerOption

EagerOption

class EagerOption : Option

An Option with no values that is finalized before other types of options.

Parameters

callback - 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. The callback it passed the current execution context as a parameter.

Constructors

<init>

EagerOption(vararg names: String, nvalues: Int = 0, help: String = "", hidden: Boolean = false, callback: OptionTransformContext.() -> Unit)EagerOption(names: Set<String>, nvalues: Int, help: String, hidden: Boolean, callback: OptionTransformContext.() -> Unit)

An Option with no values that is finalized before other types of options.

Properties

help

val help: String

The description of this option, usually a single line.

hidden

val hidden: Boolean

If true, this option should not appear in help output.

metavar

val metavar: String?

A name representing the values for this option that can be displayed to the user.

names

val names: Set<String>

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

nvalues

val nvalues: Int

The number of values that must be given to this option.

parser

val parser: OptionParser

The parser for this option's values.

secondaryNames

val secondaryNames: Set<String>

Names that can be used for a secondary purpose, like disabling flag options.

Inherited Properties

parameterHelp

open val parameterHelp: Option?

Information about this option for the help output.

Functions

finalize

fun finalize(context: Context, invocations: List<Invocation>): Unit

Called after this command's argv is parsed to transform and store the option's value.