aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.rs8
-rw-r--r--src/lib.rs3
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);
diff --git a/src/lib.rs b/src/lib.rs
index e9038dc..76e6fd4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,3 +9,6 @@ mod suggestion;
pub use suggestion::for_suggestion;
+
+
+const VERSION: &'static str = "0.1.0";