ConfirmationPrompt

A prompt that is answered with a yes or no.

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)
The prompt markup text.

Properties

Comparer : StringComparer

Gets or sets the string comparer to use when comparing user input against Yes/No choices.

DefaultValue : bool

Gets or sets a value indicating whether "yes" is the default answer.

InvalidChoiceMessage : string

Gets or sets the message for invalid choices.

No : char

Gets or sets the character that represents "no".

RequireEnter : bool

Gets or sets a value indicating whether or not the enter key is required after input

ShowChoices : bool

Gets or sets a value indicating whether or not choices should be shown.

ShowDefaultValue : bool

Gets or sets a value indicating whether or not default values should be shown.

Yes : char

Gets or sets the character that represents "yes".

Methods

public bool Show(IAnsiConsole console)

Shows the prompt.

Parameters:

console (IAnsiConsole)
The console.

Returns:

The prompt input result.

public Task<bool> ShowAsync(IAnsiConsole console, CancellationToken cancellationToken)

Shows the prompt asynchronously.

Parameters:

console (IAnsiConsole)
The console.
cancellationToken (CancellationToken)
The token to monitor for cancellation requests.

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.