Skip to content
ConsoleMonster
Class

ConfirmPrompt

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

A yes/no question with the default shown: ? Continue? [ Yes ] No. Y and N answer at once, arrows move between the answers, Enter takes the focused one, Esc answers no.

Inheritance

Usage

Explore 29 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 14

Constructors

ConfirmPrompt 2 overloads
public ConfirmPrompt(string title) #

Creates a confirmation.

Parameters

title string required
The question.
public ConfirmPrompt(string title, bool defaultValue) #

Creates a confirmation with a default.

Parameters

title string required
The question.
defaultValue bool required
The default answer.

Methods

public override string Describe(bool value) #

The answer as text, for the summary line left in the scrollback.

Parameters

value bool required
The answer.

Returns

string The text.

Properties

public bool Destructive { get; set; } #

Marks the question as destructive: a warning mark, and No is focused unless the default says otherwise.

public string? YesText { get; set; } #

The caption of the positive answer; null uses the labels.

public string? NoText { get; set; } #

The caption of the negative answer; null uses the labels.

Extension Methods

public static ConfirmPrompt Default(ConfirmPrompt confirmPrompt, bool value = true) #

Sets Prompt<bool>.Default: The default answer: pre-selected, accepted with Enter, and returned in non-interactive sessions.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property     // C# fluent
confirmPrompt.Default = value;    Ui.ConfirmPrompt().Default(value);
public static ConfirmPrompt Description(ConfirmPrompt confirmPrompt, string? value) #

Sets Prompt<bool>.Description: Help text under the question.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value string? required
The value.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property         // C# fluent
confirmPrompt.Description = value;    Ui.ConfirmPrompt().Description(value);
public static ConfirmPrompt Destructive(ConfirmPrompt confirmPrompt, bool value = true) #

Sets ConfirmPrompt.Destructive: Marks the question as destructive: a warning mark, and No is focused unless the default says otherwise.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property         // C# fluent
confirmPrompt.Destructive = value;    Ui.ConfirmPrompt().Destructive(value);
public static ConfirmPrompt NoText(ConfirmPrompt confirmPrompt, string? value) #

Sets ConfirmPrompt.NoText: The caption of the negative answer; null uses the labels.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value string? required
The value.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property    // C# fluent
confirmPrompt.NoText = value;    Ui.ConfirmPrompt().NoText(value);
public static ConfirmPrompt ParameterName(ConfirmPrompt confirmPrompt, string? value) #

Sets Prompt<bool>.ParameterName: The parameter that supplies this value non-interactively (-Domain, --domain); named in the non-interactive error message.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value string? required
The value.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property           // C# fluent
confirmPrompt.ParameterName = value;    Ui.ConfirmPrompt().ParameterName(value);
public static ConfirmPrompt Title(ConfirmPrompt confirmPrompt, string value) #

Sets Prompt<bool>.Title: The question.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value string required
The value.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property    // C# fluent
confirmPrompt.Title = value;     Ui.ConfirmPrompt().Title(value);
public static ConfirmPrompt YesText(ConfirmPrompt confirmPrompt, string? value) #

Sets ConfirmPrompt.YesText: The caption of the positive answer; null uses the labels.

Parameters

confirmPrompt ConsoleMonster.Interactive.ConfirmPrompt required
The instance.
value string? required
The value.

Returns

ConfirmPrompt The same instance.

Examples

// C# initializer or property     // C# fluent
confirmPrompt.YesText = value;    Ui.ConfirmPrompt().YesText(value);