pub fn select<S: ToString>(
prompt: impl ToString,
options: impl IntoIterator<Item = S>,
default: Option<usize>,
) -> Result<S, Error>
Expand description
Prompts the user to select on the given values.
§Arguments
prompt
: The prompt to display to the user.options
: A list of options to select from.default
: If notNone
, then the select highlights another item than the first.
§Returns
The selected option. If the user aborted the select, None
is returned instead.
§Errors
This function errors if we failed to interact with the user.