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