SelectionPromptExtensions

Contains extension methods for .

Contains extension methods for SelectionPrompt.

Methods

public static SelectionPrompt<T> AddCancelResult<T>(SelectionPrompt<T> obj, Func<T> cancelResultFunc)

Sets the value that will be returned if the prompt is cancelled with 'ESC'.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
cancelResultFunc (Func<T>)
A Func that is returning a value on cancel.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> AddCancelResult<T>(SelectionPrompt<T> obj, T cancelResult)

Sets a Func that will be triggered if the prompt is cancelled with 'ESC'.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
cancelResult (T)
The value to be returned on cancel.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> AddChoiceGroup<T>(SelectionPrompt<T> obj, T group, IEnumerable<T> choices)

Adds multiple grouped choices.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
group (T)
The group.
choices (IEnumerable<T>)
The choices to add.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> AddChoiceGroup<T>(SelectionPrompt<T> obj, T group, T[] choices)

Adds multiple grouped choices.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
group (T)
The group.
choices (T[])
The choices to add.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> AddChoices<T>(SelectionPrompt<T> obj, T[] choices)

Adds multiple choices.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
choices (T[])
The choices to add.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> AddChoices<T>(SelectionPrompt<T> obj, IEnumerable<T> choices)

Adds multiple choices.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
choices (IEnumerable<T>)
The choices to add.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> DefaultValue<T>(SelectionPrompt<T> obj, T defaultValue)

Sets the choice that will be selected when the prompt is first displayed.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
defaultValue (T)
The choice to show as selected when the prompt is first displayed.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> DisableSearch<T>(SelectionPrompt<T> obj)

Disables search for the prompt.

Parameters:

obj (SelectionPrompt<T>)
The prompt.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> EnableSearch<T>(SelectionPrompt<T> obj)

Enables search for the prompt.

Parameters:

obj (SelectionPrompt<T>)
The prompt.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> Mode<T>(SelectionPrompt<T> obj, SelectionMode mode)

Sets the selection mode.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
mode (SelectionMode)
The selection mode.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> MoreChoicesText<T>(SelectionPrompt<T> obj, string text)

Sets the text that will be displayed if there are more choices to show.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
text (string)
The text to display.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> PageSize<T>(SelectionPrompt<T> obj, int pageSize)

Sets how many choices that are displayed to the user.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
pageSize (int)
The number of choices that are displayed to the user.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> SearchPlaceholderText<T>(SelectionPrompt<T> obj, string text)

Sets the text that will be displayed when no search text has been entered.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
text (string)
The text to display.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> Title<T>(SelectionPrompt<T> obj, string title)

Sets the title.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
title (string)
The title markup text.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> UseConverter<T>(SelectionPrompt<T> obj, Func<T, string> displaySelector)

Sets the function to create a display string for a given choice.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
displaySelector (Func<T, string>)
The function to get a display string for a given choice.

Returns:

The same instance so that multiple calls can be chained.

public static SelectionPrompt<T> WrapAround<T>(SelectionPrompt<T> obj, bool shouldWrap = true)

Sets whether the selection should wrap around when reaching its edges.

Parameters:

obj (SelectionPrompt<T>)
The prompt.
shouldWrap (bool)
Whether the selection should wrap around.

Returns:

The same instance so that multiple calls can be chained.