combined/
combined.rs

1use xacli_components::{Confirm, Input, Select};
2
3fn main() {
4    println!("=== Combined Components Demo ===\n");
5
6    // 1. Input
7    let name = match Input::new("What's your name?").run() {
8        Ok(n) => n,
9        Err(e) => {
10            eprintln!("Error: {}", e);
11            return;
12        }
13    };
14
15    println!();
16
17    // 2. Select
18    let color = match Select::new("Choose your favorite color:")
19        .option("Red", "red")
20        .option("Green", "green")
21        .option("Blue", "blue")
22        .run()
23    {
24        Ok(c) => c,
25        Err(e) => {
26            eprintln!("Error: {}", e);
27            return;
28        }
29    };
30
31    println!();
32
33    // 3. Confirm
34    let confirmed = match Confirm::new("Save preferences?").default(true).run() {
35        Ok(c) => c,
36        Err(e) => {
37            eprintln!("Error: {}", e);
38            return;
39        }
40    };
41
42    println!();
43
44    if confirmed {
45        println!("✓ Saved: name={}, color={}", name, color);
46    } else {
47        println!("✗ Not saved");
48    }
49}