Function select

Source
pub fn select<'a>(before: &'a str, options: &'a [&'a str]) -> usize
Expand description

Allows the user to select one option from a list using the console.

This function displays a list of options. The user can navigate through the options using arrow keys or ‘w’ and ‘s’ keys. If the user presses Enter, the function returns the selected option.

§Arguments

  • before - The text to display before the list of options.
  • options - A vector of strings representing the available options.

§Returns

Returns an usize as an index of the inputted array options