Skip to content

Commit

Permalink
feat: Split subcommand main modules from main
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Mar 8, 2024
1 parent 9ea32d7 commit d42e67c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod version;
4 changes: 4 additions & 0 deletions src/commands/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub fn run() {
let version = super::super::VERSION;
println!("Running gazer v{version}");
}
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Entry point.
mod commands;
use clap::{Parser, Subcommand};

const VERSION: &'static str = "0.0.0";
Expand All @@ -20,7 +21,7 @@ fn main() {
let cli = Cli::parse();
match &cli.command {
Some(Commands::Version {}) => {
println!("Running gazer v{VERSION}");
commands::version::run();
}
None => {}
}
Expand Down

0 comments on commit d42e67c

Please sign in to comment.