Skip to content
ConsoleMonster

API Reference

Class

TextPrompt

Namespace ConsoleMonster.Interactive
Assembly ConsoleMonster
Base Prompt<String>
Modifiers sealed

A line of text: a default (shown as a hint, accepted with Enter on an empty line, Tab puts it in the box to edit), a placeholder, required/length/pattern checks and a custom validator with an inline error, and history on Up/Down.

Inheritance

  • Prompt<String>
  • TextPrompt

Constructors

public TextPrompt(String title) #

Creates a text prompt.

Parameters

title System.String requiredposition: 0
The question.

Methods

public override String Describe(String value) #
Returns: String

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

Parameters

value System.String requiredposition: 0
The answer.

Returns

The text.

Properties

public String? Placeholder { get; set; } #

Muted text in the empty box.

public Boolean Required { get; set; } #

Whether an empty answer is refused (when there is no default).

public Int32 MinLength { get; set; } #

The fewest characters accepted.

public Int32 MaxLength { get; set; } #

The most characters the box takes.

public String? Pattern { get; set; } #

A pattern the whole answer must match.

public String? PatternMessage { get; set; } #

The message when TextPrompt.Pattern does not match.

public Func<String, String?>? Validator { get; set; } #

A validator: returns an error message, or null when the answer is fine.

public IList<String> History { get; } #

Earlier answers offered with Up and Down (oldest first).

public Boolean PrefillDefault { get; set; } #

Starts with the default in the box (editable) instead of showing it as a hint.