default_menu_cmd

Function default_menu_cmd 

Source
pub fn default_menu_cmd() -> Option<Command>
Expand description

Returns the user’s preferred menu program from the MENU environment variable if it exists.

Use .as_mut() on the returned value to turn in into an Option<&mut Command>.

Examples found in repository?
examples/demo.rs (line 14)
6fn main() {
7    println!("Interactor demo. Type something:");
8
9    let read_result = read_from_tty(|buf, b, tty| {
10        tty.write(&format!("({:?} | {})\n", buf, b).into_bytes());
11    }, false, false).unwrap();
12    println!("Read: {}", String::from_utf8(read_result).unwrap());
13
14    let chosen_ext = pick_from_list(default_menu_cmd().as_mut(), &["first", "second"], "").unwrap();
15    println!("Congratulations, you chose '{}'!!", chosen_ext);
16
17    let chosen_file = pick_file(|| default_menu_cmd(), std::env::current_dir().unwrap()).unwrap();
18    println!("Congratulations, you chose '{}'!!", chosen_file.display());
19
20    let chosen_int = pick_from_list(None, &["first", "second"], "Selection: ").unwrap();
21    println!("Congratulations, you chose '{}'!!", chosen_int);
22}