aboutsummaryrefslogtreecommitdiff
path: root/mingling_pathf/test/src/test_files/test_dispatcher_clap.rs
blob: 33d86e03523276585be0da18efe151dade4edc65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Basic: entry type only (no CMD type specified)
#[mingling::macros::dispatcher_clap]
struct EntryClap1 {
    name: String,
    age: i32,
}

#[mingling::macros::dispatcher_clap]
#[command(name = "greet")]
pub struct EntryClap2 {
    name: String,
}

#[dispatcher_clap]
struct EntryClap3 {
    value: String,
}

#[dispatcher_clap]
pub struct EntryClap4 {
    value: i32,
}

// With CMD type
#[dispatcher_clap("greet", CMDGreet)]
struct EntryWithCmd {
    name: String,
}

// With CMD + error
#[dispatcher_clap("delete", CMDDelete, error = ErrorDelete)]
struct EntryWithError {
    id: u64,
}

// With CMD + help
#[dispatcher_clap("helpcmd", CMDHelp, help = true)]
struct EntryWithHelp {
    verbose: bool,
}

// With CMD + error + help
#[dispatcher_clap("full", CMDFull, error = ErrorFull, help = true)]
struct EntryFull {
    all: bool,
}

pub mod sub {
    #[mingling::macros::dispatcher_clap]
    struct EntryClap1 {
        name: String,
    }

    #[dispatcher_clap]
    struct EntryClap3 {
        value: String,
    }

    #[dispatcher_clap("greet", CMDGreet)]
    struct EntryWithCmd {
        name: String,
    }

    #[dispatcher_clap("delete", CMDDelete, error = ErrorDelete)]
    struct EntryWithError {
        id: u64,
    }

    #[dispatcher_clap("helpcmd", CMDHelp, help = true)]
    struct EntryWithHelp {
        verbose: bool,
    }
}