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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
use crate::{
branch::branch::process_branch_commands,
cli::cli::{Cli, Commands},
commands::{
commit::commit::commit_command, diff::diff::diff_command,
healthcheck::healthcheck::healthcheck_command, init::init::init_command,
push::push::push_command, stage::stage::stage_command,
state::state::state_command, unstage::unstage::unstage_command,
update::update::update_command,
},
};
/// Handler for the various CLI commands
pub fn process_args(args: Cli) {
let args = args.command;
match args {
//////////////////////////////////////////////////////////////
// Commands for starting repositories (local, remote, both) //
//////////////////////////////////////////////////////////////
Commands::New(new_repo_options) => {
println!("New: {}", new_repo_options.name);
}
Commands::Init(init_options) => {
init_command(init_options);
}
//////////////////////////////////////////////////////////////
// Declarative high-level operations on the top of the VCS. //
// with improved usage information and diagnostics. //
// - State //
// - Stage //
// - Unstage //
// - Commit //
// - Diff //
//////////////////////////////////////////////////////////////
Commands::State(state_options) => {
state_command(state_options);
}
Commands::Stage(stage_options) => {
stage_command(stage_options);
}
Commands::Unstage(unstage_options) => {
unstage_command(unstage_options);
}
Commands::Commit(commit_options) => {
commit_command(commit_options);
}
Commands::Push(push_options) => {
push_command(push_options);
}
Commands::Pull(pull_options) => {
println!("Pull: {}", pull_options.info);
// pull_command(pull_options, start_time);
}
Commands::Diff(diff_options) => {
diff_command(diff_options);
}
///////////////////////////////////
// Branching commands along with //
// branching strategies //
///////////////////////////////////
Commands::Branch(branch_commands) => {
process_branch_commands(branch_commands)
}
////////////////////////////
// Various setup commands //
////////////////////////////
// Commands::Setup(setup_options) => {
// println!("Setup {}", setup_options.info);
// }
//////////////////////////////////////////////////
// Commands to ensure system is setup for usage //
// w/ the underlying components which make up //
// scud //
//////////////////////////////////////////////////
Commands::Healthcheck => {
healthcheck_command();
}
//
Commands::Update(update_options) => {
update_command(update_options);
}
/////////////////////////////////////////////
// Handler for processing unknown commands //
/////////////////////////////////////////////
_ => {
!unreachable!();
}
}
}