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


fun Any> NullableOption.prompt(text: String? = null, default: String? = null, hideInput: Boolean = false, requireConfirmation: Boolean = false, confirmationPrompt: String = “Repeat for confirmation: “, promptSuffix: String = “: “, showDefault: Boolean = true): OptionWithValues

If the option isn’t given on the command line, prompt the user for manual input.


text - The text to prompt the user with

default - The default value to use if no input is given. If null, the prompt will be repeated until input is given.

hideInput - If true, user input will not be shown on the screen. Useful for passwords and sensitive input.

requireConfirmation - If true, the user will be required to enter the same value twice before it is accepted.

confirmationPrompt - If requireConfirmation is true, this will be used to ask for input again.

promptSuffix - Text to display directly after text. Defaults to “: “.

showDefault - Show default to the user in the prompt.