Skip to content

Commit 661c091

Browse files
committed
feat(cli): add new version command
1 parent d6644ca commit 661c091

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/cli.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub enum CliCommand {
99
Setup,
1010
Branch,
1111
Project,
12+
Version,
1213
}
1314

1415
impl CliCommand {
@@ -19,6 +20,7 @@ impl CliCommand {
1920
"config" => CliCommand::Config,
2021
"setup" => CliCommand::Setup,
2122
"branch" => CliCommand::Branch,
23+
"version" => CliCommand::Version,
2224
_ => CliCommand::Help,
2325
}
2426
}

src/main.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ use crate::cli::get_program_info;
77
use crate::cli::CliCommand;
88
use crate::commands::projects;
99

10-
/**
11-
* switcher project add <PROJECT_NAME> <|PROJECT_PATH>
12-
* switcher config <|detail|d>
13-
* switcher setup <PROJECT_NAME>
14-
* switcher branch <PROJECT_NAME> <BRANCH>
15-
*/
16-
1710
fn print_help() {
1811
println!("
1912
Switcher is a simple organizer for projects with multi-repositories gives you the ability to do bulk git actions on all of them
@@ -31,6 +24,16 @@ Examples:
3124
");
3225
}
3326

27+
fn print_version() {
28+
const NAME: &str = env!("CARGO_PKG_NAME");
29+
const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
30+
const VERSION: &str = env!("CARGO_PKG_VERSION");
31+
const REPOSITORY: &str = env!("CARGO_PKG_REPOSITORY");
32+
println!("{} v{}
33+
By: {}
34+
Repoistory: {}", NAME, VERSION, AUTHORS, REPOSITORY);
35+
}
36+
3437
fn main() {
3538
config::init();
3639

@@ -42,5 +45,6 @@ fn main() {
4245
CliCommand::Branch => projects::sync_projects(program_info),
4346
CliCommand::Config => config::print(program_info),
4447
CliCommand::Project => projects::check(program_info),
48+
CliCommand::Version => print_version(),
4549
}
4650
}

0 commit comments

Comments
 (0)