Skip to content

Commit

Permalink
Add arg for get of app version
Browse files Browse the repository at this point in the history
  • Loading branch information
ChugunovRoman committed Sep 1, 2019
1 parent e1831a6 commit 6d7c1be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::{env, process};

pub fn init() {
let mut args = env::args();
args.next();

if let Some(version) = args.next() {
if version == "-v" {
println!("{}", env!("CARGO_PKG_VERSION"));
process::exit(0);
}
}
}
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
mod app;
mod args;
mod config;
mod log;
mod routes;
mod server;

fn main() {
args::init();
log::init();
app::init();
}

0 comments on commit 6d7c1be

Please sign in to comment.