diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..7c854a6 --- /dev/null +++ b/src/args.rs @@ -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); + } + } +} diff --git a/src/main.rs b/src/main.rs index 3638a79..a552cef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,12 @@ mod app; +mod args; mod config; mod log; mod routes; mod server; fn main() { + args::init(); log::init(); app::init(); }