list

Function list 

Source
pub fn list<T: Into<String>, T2: IntoIterator>(
    name: T,
    values: T2,
) -> TerminalMenuItem
where T2::Item: Into<String>,
Expand description

Make a terminal-menu item from which you can select a value from a selection. Only the selected value is visible.

ยงExample

use terminal_menu::{menu, list, run, mut_menu};
let menu = menu(vec![
    list("My Lists Name", vec![
        "First Option",
        "Second Option",
        "Third Option"
    ])
]);
run(&menu);
println!("My Lists Value: {}", mut_menu(&menu).selection_value("My Lists Name"));
Examples found in repository?
examples/readme.rs (line 9)
1fn main() {
2    use terminal_menu::{run, menu, label, scroll, list, string, password, numeric, submenu, back_button};
3    let menu = menu(vec![
4        label("--------------"),
5        label("MY lovely menu!"),
6        label("usage: tinker around"),
7        label("---------------"),
8        scroll("Selection", vec!["First Option", "Second Option", "Third Option"]),
9        list("Do Something", vec!["Yes", "No"]),
10        string("Your Name", "Samuel", false),
11        password("Your Password", "pass", false),
12        numeric("Numeric", 5.25, None, None, None),
13        submenu("Submenu", vec![back_button("Back")]),
14        back_button("Exit"),
15    ]);
16    run(&menu);
17}
More examples
Hide additional examples
examples/selections.rs (line 19)
5fn main() {
6    use terminal_menu::{menu, label, button, list, scroll, run, mut_menu};
7    let menu = menu(vec![
8        label("lists and scrolls"),
9
10        // with list and scroll you can select a value from a group of values
11        // you can change the selected value with arrow keys, wasd, or enter
12
13        // use arrow keys or wasd
14        // enter to select
15
16        // list:
17        //  show all values
18        //  surround the selected value with brackets
19        list("li", vec!["Alice", "Bob", "Charlie"]),
20
21        // scroll:
22        //  show only the selected item
23        scroll("sc", vec!["Alice", "Bob", "Charlie"]),
24
25        button("exit")
26    ]);
27    run(&menu);
28    {
29        let mm = mut_menu(&menu);
30        if mm.canceled() {
31            println!("Canceled!");
32            return;
33        }
34        println!("{}", mm.selection_value("li"));
35        println!("{}", mm.selection_value("sc"));
36    }
37}