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
use std::path::PathBuf;

pub mod define;

pub mod map_to_operation;

pub enum Operation {
    Commit,
    BranchFromClipboard,
    BranchFromTemplate,
    SetCommitFormat,
    SetBranchFormat,
    SetBranchPrefix,
    Show,
}

pub struct SetFormat {
    pub key: String,
    pub value: String,
}

pub struct CheckoutToPrefix {
    pub prefix_key: String,
    pub copy: bool,
    pub dry_run: bool,
}

pub struct DryRunAndCopyFlag {
    pub dry_run: bool,
    pub copy: bool,
}

pub struct UseTemplate {
    pub key: String,
    pub interpolate_values: Vec<String>,
    pub use_autocomplete: bool,
    pub copy: bool,
    pub dry_run: bool,
}

pub struct CommitSubcommandFlags {
    pub use_branch_number: bool,
    pub copy: bool,
    pub dry_run: bool,
}

pub struct CommitOperationArguments {
    pub use_template: UseTemplate,
    pub flags: CommitSubcommandFlags,
}
pub struct SetClipboardCommands {
    pub copy: String,
    pub paste: String,
}

pub enum OperationWithArguments {
    Commit(CommitOperationArguments),
    BranchFromClipboard(CheckoutToPrefix),
    BranchFromTemplate(UseTemplate),
    SetCommitFormat(SetFormat),
    SetBranchFormat(SetFormat),
    SetBranchPrefix(SetFormat),
    SetClipboardCommands(SetClipboardCommands),
    Show,
    GenerateAutocompletionScript(PathBuf),
}

pub struct ParsedArguments {
    pub operation_with_arguments: OperationWithArguments,
    pub path_to_config: PathBuf,
}