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

Style ChoicesStyle
Gets or sets the style in which the list of choices is displayed. Defaults to blue when .
StringComparer Comparer
Gets or sets the string comparer to use when comparing user input against Yes/No choices.
bool DefaultValue
Gets or sets a value indicating whether "yes" is the default answer.
Style DefaultValueStyle
Gets or sets the style in which the default value is displayed. Defaults to green when .
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 ChoicesStyle(Style)
Sets the style in which the list of choices is displayed.
ConfirmationPrompt DefaultValueStyle(Style)
Sets the style in which the default value is displayed.
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".