Skip to content
ConsoleMonster
Class

TypedConfirmPrompt

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

The confirmation for destructive actions: the user types a given text (a name, a domain) before Enter is accepted. Returns true when confirmed and false when the user backs out with Esc.

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

public TypedConfirmPrompt(string title, string expected) #

Creates a typed confirmation.

Parameters

title string required
The question ("Remove 3 servers from the inventory?").
expected string required
The text to type.

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.
public override bool Show(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #

Asks the question and returns the answer.

Parameters

options ConsoleMonster.Interactive.InteractiveOptions? = null optional
Options; null uses InteractiveOptions.Default.
cancellationToken System.Threading.CancellationToken = default optional
Cancels the prompt.

Returns

bool The answer.

Exceptions

Properties

public string Expected { get; set; } #

The text to type.

public bool CaseSensitive { get; set; } #

Whether case must match too.

public string? Warning { get; set; } #

A warning under the question (default: none).

Extension Methods

public static TypedConfirmPrompt CaseSensitive(TypedConfirmPrompt typedConfirmPrompt, bool value = true) #

Sets TypedConfirmPrompt.CaseSensitive: Whether case must match too.

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TypedConfirmPrompt The same instance.

Examples

// C# initializer or property                // C# fluent
typedConfirmPrompt.CaseSensitive = value;    Ui.TypedConfirmPrompt().CaseSensitive(value);
public static TypedConfirmPrompt Default(TypedConfirmPrompt typedConfirmPrompt, bool value = true) #

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

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TypedConfirmPrompt The same instance.

Examples

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

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

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value string? required
The value.

Returns

TypedConfirmPrompt The same instance.

Examples

// C# initializer or property              // C# fluent
typedConfirmPrompt.Description = value;    Ui.TypedConfirmPrompt().Description(value);
public static TypedConfirmPrompt Expected(TypedConfirmPrompt typedConfirmPrompt, string value) #

Sets TypedConfirmPrompt.Expected: The text to type.

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value string required
The value.

Returns

TypedConfirmPrompt The same instance.

Examples

// C# initializer or property           // C# fluent
typedConfirmPrompt.Expected = value;    Ui.TypedConfirmPrompt().Expected(value);
public static TypedConfirmPrompt ParameterName(TypedConfirmPrompt typedConfirmPrompt, string? value) #

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

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value string? required
The value.

Returns

TypedConfirmPrompt The same instance.

Examples

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

Sets Prompt<bool>.Title: The question.

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value string required
The value.

Returns

TypedConfirmPrompt The same instance.

Examples

// C# initializer or property        // C# fluent
typedConfirmPrompt.Title = value;    Ui.TypedConfirmPrompt().Title(value);
public static TypedConfirmPrompt Warning(TypedConfirmPrompt typedConfirmPrompt, string? value) #

Sets TypedConfirmPrompt.Warning: A warning under the question (default: none).

Parameters

typedConfirmPrompt ConsoleMonster.Interactive.TypedConfirmPrompt required
The instance.
value string? required
The value.

Returns

TypedConfirmPrompt The same instance.

Examples

// C# initializer or property          // C# fluent
typedConfirmPrompt.Warning = value;    Ui.TypedConfirmPrompt().Warning(value);