enum_gender/
enum_gender.rs

1use derive_wizard::Wizard;
2
3#[derive(Debug, Wizard)]
4#[allow(unused)]
5struct ShowCase {
6    // String types - defaults to 'input'
7    #[prompt("Enter your name:")]
8    name: String,
9
10    // Override with password question type
11    #[prompt("Enter your password:")]
12    #[mask]
13    password: String,
14
15    // Long text with editor
16    #[prompt("Enter a bio:")]
17    #[editor]
18    bio: String,
19
20    // Bool type - defaults to 'confirm'
21    #[prompt("Do you agree to the terms?")]
22    agree: bool,
23
24    // Integer types - defaults to 'int'
25    #[prompt("Enter your age (i32):")]
26    age: i32,
27
28    // Float types - defaults to 'float'
29    #[prompt("Enter your height in meters (f64):")]
30    height: f64,
31
32    #[prompt("Enter a decimal number (f32):")]
33    decimal: f32,
34
35    #[prompt("Enter your gender")]
36    gender: Gender,
37}
38
39#[derive(Debug, Wizard)]
40enum Gender {
41    Male,
42    Female,
43    Other(
44        #[prompt("Please specify:")]
45        #[allow(unused)]
46        String,
47    ),
48}
49
50fn main() {
51    let magic = ShowCase::wizard_builder().build();
52    println!("Config: {magic:#?}");
53}