Add support for --help and -h
This commit is contained in:
parent
ecbbc3dfc1
commit
cd70c68a01
1 changed files with 14 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue