forked from drewdeponte/git-ps-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
54 lines (50 loc) · 2.09 KB
/
main.rs
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
// This is the the main application module. In module namespacing it is the
// `crate` module. It is generally responsible for housing the main() entry
// point. In our case we have the main entry point responsible for the
// following:
//
// - declaring the CLI options interface & help messaging
// - parsing the CLI options into a data structure (ApplicationArguments)
// - map CLI options data structure to subcommand calls & arguments
//
// So any code that fits the above responsibilities should live within this
// module.
mod cli;
mod commands;
use clap::Parser;
fn main() {
let cli = cli::Cli::parse();
match cli.command {
cli::Command::Branch(opts) => {
commands::branch::branch(opts.patch_index_or_range, opts.branch_name, cli.color)
}
cli::Command::Integrate(opts) => commands::integrate::integrate(
opts.patch_index_or_range,
opts.force,
opts.keep_branch,
opts.branch_name,
cli.color,
),
cli::Command::List => commands::list::list(cli.color),
cli::Command::Rebase(opts) => commands::rebase::rebase(opts.r#continue),
cli::Command::Pull => commands::pull::pull(cli.color),
cli::Command::RequestReview(opts) => commands::request_review::request_review(
opts.patch_index_or_range_batch,
opts.branch_name,
cli.color,
opts.isolation_verification_hook,
opts.post_sync_hook,
),
cli::Command::Sha(opts) => {
commands::sha::sha(opts.patch_index, cli.color, opts.exclude_newline)
}
cli::Command::Show(opts) => commands::show::show(opts.patch_index_or_range),
cli::Command::Isolate(opts) => {
commands::isolate::isolate(opts.patch_index_or_range, cli.color)
}
cli::Command::Checkout(opts) => commands::checkout::checkout(opts.patch_index),
cli::Command::Fetch => commands::fetch::fetch(cli.color),
#[cfg(feature = "backup_cmd")]
cli::Command::BackupStack(opts) => commands::backup_stack::backup_stack(opts.branch_name),
};
}