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>)cancelResultFunc (Func<List<T>>)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>)cancelResult (List<T>)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>)cancelResult (T)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>)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>)group (T)choices (IEnumerable<T>)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>)group (T)choices (T[])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>)choice (T)configurator (Action<IMultiSelectionItem<T>>)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>)choices (T[])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>)choices (IEnumerable<T>)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>)defaultValue (T)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>)text (string)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>)mode (SelectionMode)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>)text (string)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>)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>)pageSize (int)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>)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>)required (bool)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>)item (T)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>)title (string)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>)displaySelector (Func<T, string>)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>)shouldWrap (bool)Returns:
The same instance so that multiple calls can be chained.