ConfirmationPrompt Class

A prompt that is answered with a yes or no.
public sealed class ConfirmationPrompt : IPrompt<bool>
Namespace
Spectre.Console
Interfaces

Constructors

ConfirmationPrompt(string)
Initializes a new instance of the ConfirmationPrompt class.

Properties

bool DefaultValue
Gets or sets a value indicating whether "yes" is the default answer.
string InvalidChoiceMessage
Gets or sets the message for invalid choices.
char No
Gets or sets the character that represents "no".
bool ShowChoices
Gets or sets a value indicating whether or not choices should be shown.
bool ShowDefaultValue
Gets or sets a value indicating whether or not default values should be shown.
char Yes
Gets or sets the character that represents "yes".

Methods

bool Show(IAnsiConsole)
Shows the prompt.
Task<bool> ShowAsync(IAnsiConsole, CancellationToken)
Shows the prompt asynchronously.

Extension Methods

ConfirmationPrompt HideChoices()
Hides choices.
ConfirmationPrompt HideDefaultValue()
Hides the default value.
ConfirmationPrompt InvalidChoiceMessage(string)
Sets the "invalid choice" message for the prompt.
ConfirmationPrompt No(char)
Sets the character to interpret as "no".
ConfirmationPrompt ShowChoices(bool)
Show or hide choices.
ConfirmationPrompt ShowChoices()
Shows choices.
ConfirmationPrompt ShowDefaultValue(bool)
Show or hide the default value.
ConfirmationPrompt ShowDefaultValue()
Shows the default value.
ConfirmationPrompt Yes(char)
Sets the character to interpret as "yes".