Add support for --help and -h

This commit is contained in:
Matthias Beyer 2016-08-07 14:31:34 +02:00
parent ecbbc3dfc1
commit cd70c68a01

View file

@ -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);