1use console::Term;
2use dialoguer::{theme::ColorfulTheme, Confirm, Input, MultiSelect, Select, Sort};
3
4fn main() {
5 let items = &[
6 "Ice Cream",
7 "Vanilla Cupcake",
8 "Chocolate Muffin",
9 "A Pile of sweet, sweet mustard",
10 ];
11 let term = Term::buffered_stderr();
12 let theme = ColorfulTheme::default();
13
14 println!("All the following controls are run in a buffered terminal");
15 Confirm::with_theme(&theme)
16 .with_prompt("Do you want to continue?")
17 .interact_on(&term)
18 .unwrap();
19
20 let _: String = Input::with_theme(&theme)
21 .with_prompt("Your name")
22 .interact_on(&term)
23 .unwrap();
24
25 Select::with_theme(&theme)
26 .with_prompt("Pick an item")
27 .items(items)
28 .interact_on(&term)
29 .unwrap();
30
31 MultiSelect::with_theme(&theme)
32 .with_prompt("Pick some items")
33 .items(items)
34 .interact_on(&term)
35 .unwrap();
36
37 Sort::with_theme(&theme)
38 .with_prompt("Order these items")
39 .items(items)
40 .interact_on(&term)
41 .unwrap();
42}