MultiSelectionPromptExtensions

Contains extension methods for .

Contains extension methods for MultiSelectionPrompt.

Methods

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

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

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

public static MultiSelectionPrompt<T> AddCancelResult<T>(MultiSelectionPrompt<T> obj, List<T> cancelResult)

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

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

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

Sets a Func that will be triggered if the prompt is cancelled with 'ESC'. Sets result to a List containing only the configured item.

Parameters:

obj (MultiSelectionPrompt<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 MultiSelectionPrompt<T> AddCancelResult<T>(MultiSelectionPrompt<T> obj)

Sets a Func that will be triggered if the prompt is cancelled with 'ESC'. Sets result to an empty List.

Parameters:

obj (MultiSelectionPrompt<T>)
The prompt.

Returns:

The same instance so that multiple calls can be chained.

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

Adds multiple grouped choices.

Parameters:

obj (MultiSelectionPrompt<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 MultiSelectionPrompt<T> AddChoiceGroup<T>(MultiSelectionPrompt<T> obj, T group, T[] choices)

Adds multiple grouped choices.

Parameters:

obj (MultiSelectionPrompt<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 MultiSelectionPrompt<T> AddChoices<T>(MultiSelectionPrompt<T> obj, T choice, Action<IMultiSelectionItem<T>> configurator)

Adds a choice.

Parameters:

obj (MultiSelectionPrompt<T>)
The prompt.
choice (T)
The choice to add.
configurator (Action<IMultiSelectionItem<T>>)
The configurator for the choice.

Returns:

The same instance so that multiple calls can be chained.

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

Adds multiple choices.

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

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

Adds multiple choices.

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

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

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

Parameters:

obj (MultiSelectionPrompt<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 MultiSelectionPrompt<T> InstructionsText<T>(MultiSelectionPrompt<T> obj, string text)

Sets the text that instructs the user of how to select items.

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

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

Sets the selection mode.

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

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

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

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

public static MultiSelectionPrompt<T> NotRequired<T>(MultiSelectionPrompt<T> obj)

Requires no choice to be selected.

Parameters:

obj (MultiSelectionPrompt<T>)
The prompt.

Returns:

The same instance so that multiple calls can be chained.

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

Sets how many choices that are displayed to the user.

Parameters:

obj (MultiSelectionPrompt<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 MultiSelectionPrompt<T> Required<T>(MultiSelectionPrompt<T> obj)

Requires a choice to be selected.

Parameters:

obj (MultiSelectionPrompt<T>)
The prompt.

Returns:

The same instance so that multiple calls can be chained.

public static MultiSelectionPrompt<T> Required<T>(MultiSelectionPrompt<T> obj, bool required)

Sets a value indicating whether or not at least one choice must be selected.

Parameters:

obj (MultiSelectionPrompt<T>)
The prompt.
required (bool)
Whether or not at least one choice must be selected.

Returns:

The same instance so that multiple calls can be chained.

public static MultiSelectionPrompt<T> Select<T>(MultiSelectionPrompt<T> obj, T item)

Marks an item as selected.

Parameters:

obj (MultiSelectionPrompt<T>)
The prompt.
item (T)
The item to select.

Returns:

The same instance so that multiple calls can be chained.

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

Sets the title.

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.

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

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

Parameters:

obj (MultiSelectionPrompt<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 MultiSelectionPrompt<T> WrapAround<T>(MultiSelectionPrompt<T> obj, bool shouldWrap = true)

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

Parameters:

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

Returns:

The same instance so that multiple calls can be chained.