requestty_multi_select/
requestty_multi_select.rs

1//! Requestty Multi-Select Example
2//!
3//! A simple example demonstrating multi-select with the requestty backend.
4//!
5//! Run with: cargo run --example requestty_multi_select
6
7use derive_wizard::Wizard;
8
9#[derive(Debug, Clone, Copy, Wizard)]
10pub enum Topping {
11    Pepperoni,
12    Mushrooms,
13    Olives,
14    Onions,
15    Peppers,
16    ExtraCheese,
17}
18
19#[derive(Debug, Clone, Copy, Default, Wizard)]
20pub enum Size {
21    Small,
22    #[default]
23    Medium,
24    Large,
25    Custom(#[prompt("Custom size in cm:")] u8),
26}
27
28#[derive(Debug, Wizard)]
29#[prelude("šŸ• Welcome to Pizza Order!")]
30struct PizzaOrder {
31    #[prompt("Your name:")]
32    name: String,
33
34    #[prompt("Pizza size:")]
35    size: Size,
36
37    #[prompt("Select your toppings:")]
38    toppings: Vec<Topping>,
39}
40
41fn main() {
42    let backend = derive_wizard::RequesttyBackend;
43    let order = PizzaOrder::wizard_builder()
44        .with_backend(backend)
45        .build()
46        .unwrap();
47
48    println!("\nšŸ“‹ Order Summary");
49    println!("────────────────");
50    println!("Name: {}", order.name);
51    println!("Size: {:?}", order.size);
52    println!("Toppings: {:?}", order.toppings);
53}