A prompt that is answered with a yes or no.
Constructors
public ConfirmationPrompt(string prompt)
Initializes a new instance of the ConfirmationPrompt class.
Parameters:
prompt (string)Properties
Comparer
: StringComparerGets or sets the string comparer to use when comparing user input against Yes/No choices.
DefaultValue
: boolGets or sets a value indicating whether "yes" is the default answer.
InvalidChoiceMessage
: stringGets or sets the message for invalid choices.
No
: charGets or sets the character that represents "no".
RequireEnter
: boolGets or sets a value indicating whether or not the enter key is required after input
ShowChoices
: boolGets or sets a value indicating whether or not choices should be shown.
ShowDefaultValue
: boolGets or sets a value indicating whether or not default values should be shown.
Yes
: charGets or sets the character that represents "yes".
Methods
public bool Show(IAnsiConsole console)
Shows the prompt.
Parameters:
console (IAnsiConsole)Returns:
The prompt input result.
public Task<bool> ShowAsync(IAnsiConsole console, CancellationToken cancellationToken)
Shows the prompt asynchronously.
Parameters:
console (IAnsiConsole)cancellationToken (CancellationToken)Returns:
The prompt input result.
Extension Methods
ConfirmationPrompt HideChoices(this ConfirmationPrompt obj)Hides choices.
Returns:
The same instance so that multiple calls can be chained.
ConfirmationPrompt ShowChoices(this ConfirmationPrompt obj)Shows choices.
Returns:
The same instance so that multiple calls can be chained.
ConfirmationPrompt ShowChoices(this ConfirmationPrompt obj, bool show)Show or hide choices.
Returns:
The same instance so that multiple calls can be chained.