summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-08-07 14:31:34 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-09-05 16:18:11 +0200
commitcd70c68a01b171ca6098550c9c034c01e826fd16 (patch)
tree7e8e950ef5d5ffd6cf904d57a225aa82f9023e35 /bin
parentecbbc3dfc166f5486cb17c9def17caf964e8fd60 (diff)
Add support for --help and -h
Diffstat (limited to 'bin')
-rw-r--r--bin/src/main.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/src/main.rs b/bin/src/main.rs
index fb6dba6a..03cedd72 100644
--- a/bin/src/main.rs
+++ b/bin/src/main.rs
@@ -125,10 +125,23 @@ fn main() {
.takes_value(false)
.required(false)
.multiple(false)
- .help("Get the versions of the imag commands"));
+ .help("Get the versions of the imag commands"))
+ .arg(Arg::with_name("help")
+ .long("help")
+ .short("h")
+ .takes_value(false)
+ .required(false)
+ .multiple(false)
+ .help("Show help"));
+
let matches = app.get_matches();
+ if matches.is_present("help") {
+ help(get_commands());
+ exit(0);
+ }
+
if matches.is_present("version") {
println!("imag {}", &version!()[..]);
exit(0);