pub fn cli_get_option<K, V>(question: &str, options: &IndexMap<K, V>) -> KExpand description
Prompts the user to select an option from a list.
Displays a question and list of options, then waits for the user to select one. The function will continue prompting until a valid option is selected.
§Arguments
question- The question or prompt to displayoptions- AnIndexMapof options where keys are option identifiers and values are descriptions
§Returns
Returns the key of the selected option.
§Example
use falcon_cli::{cli_get_option, indexmap};
use indexmap::IndexMap;
let options = indexmap! {
1 => "First option",
2 => "Second option",
3 => "Third option",
};
let selected = cli_get_option("Which option do you prefer?", &options);
println!("You selected: {}", selected);