diff options
| author | Teddy Wing | 2020-09-17 03:51:34 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-09-17 03:51:34 +0200 | 
| commit | 2abaebd602a528ee86558ee6a20189186499d4f7 (patch) | |
| tree | 7455f3e2265d7b98423cae49248fc602f5a3d067 /src | |
| parent | be7ba88e7d746936b7bc3ccd0ea83f46937610fe (diff) | |
| download | git-todo-2abaebd602a528ee86558ee6a20189186499d4f7.tar.bz2 | |
main.rs: Add version command line option
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/src/main.rs b/src/main.rs index dd2da1c..c231d90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ fn main() {      let mut opts = Options::new();      opts.optflag("h", "help", "print this help menu"); +    opts.optflag("V", "version", "show the program version");      let matches = match opts.parse(&args[1..]) {          Ok(m) => m, @@ -28,6 +29,11 @@ fn main() {          process::exit(exitcode::USAGE);      } +    if matches.opt_present("V") { +        println!("{}", env!("CARGO_PKG_VERSION")); +        process::exit(exitcode::OK); +    } +      let repo = match Repository::open(".") {          Ok(r) => r,          Err(e) => { | 
