Skip to content
ConsoleMonster

API Reference

Class

SelectPrompt`1

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

Pick one value from a list: type to filter (fuzzy, matches highlighted), groups, hotkeys, descriptions, badges, disabled choices with their reason, paging and an optional preview pane. Returns the value itself (any object).

Inheritance

  • Prompt<T>
  • SelectPrompt`1

Type Parameters

T
The value type.

Constructors

SelectPrompt 2 overloads
public SelectPrompt<T>(String title, IEnumerable<T?> values, Func<T?, String>? display = null, Func<T?, String?>? group = null) #

Creates a selection from values.

Parameters

title System.String requiredposition: 0
The question.
values System.Collections.Generic.IEnumerable<T?> requiredposition: 1
The values.
display System.Func<T?, System.String>? = null optionalposition: 2
The title of a value; null uses its text.
group System.Func<T?, System.String?>? = null optionalposition: 3
The group of a value; null for none.
public SelectPrompt<T>(String title, IEnumerable<Choice> choices) #

Creates a selection from prepared choices (their values must be T).

Parameters

title System.String requiredposition: 0
The question.
choices System.Collections.Generic.IEnumerable<ConsoleMonster.Interactive.Choice> requiredposition: 1
The choices.

Methods

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

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

Parameters

value T? requiredposition: 0
The answer.

Returns

The text.

Properties

public IList<Choice> Choices { get; } #

The choices, in display order.

public Func<T?, IWidget?>? Preview { get; set; } #

Preview content for the focused value.

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

Preview text for the focused value (wrapped in the preview pane).

public Int32 PageSize { get; set; } #

The preferred number of visible rows.