diff options
| -rw-r--r-- | src/config.rs | 8 | ||||
| -rw-r--r-- | src/lib.rs | 3 | 
2 files changed, 11 insertions, 0 deletions
| diff --git a/src/config.rs b/src/config.rs index 39a8158..f451ea5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,6 +6,7 @@ use git2::{self, Repository};  use thiserror::Error;  use crate::owner_repo::{self, OwnerRepo}; +use crate::VERSION;  /// Program-specific prefix for Git config values. @@ -56,6 +57,7 @@ impl Config {              "REMOTE",          );          opts.optflag("h", "help", "print this help menu"); +        opts.optflag("V", "version", "show the program version");          let opt_matches = opts.parse(&args[1..])?; @@ -65,6 +67,12 @@ impl Config {              process::exit(exitcode::USAGE);          } +        if opt_matches.opt_present("V") { +            println!("{}", VERSION); + +            process::exit(exitcode::OK); +        } +          if opt_matches.free.is_empty() {              print_usage(&opts, usage_brief); @@ -9,3 +9,6 @@ mod suggestion;  pub use suggestion::for_suggestion; + + +const VERSION: &'static str = "0.1.0"; | 
