Skip to content

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


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

Create a property delegate option.

By default, the property will return null if the option does not appear on the command line. If the option is invoked multiple times, the value from the last invocation will be used The option can be modified with functions like int, pair, and multiple.


names - The names that can be used to invoke this option. They must start with a punctuation character. If not given, a name is inferred from the property name.

help - The description of this option, usually a single line.

metavar - A name representing the values for this option that can be displayed to the user. Automatically inferred from the type.

hidden - Hide this option from help outputs.

envvar - The environment variable that will be used for the value if one is not given on the command line.

helpTags - Extra information about this option to pass to the help formatter