fix(args): check for version flag before processing values

This commit is contained in:
Orhun Parmaksız 2021-12-25 01:56:55 +03:00
parent ff1a28ed26
commit adcb7b6724
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -133,6 +133,9 @@ impl Args {
});
println!("{}", usage);
None
} else if matches.opt_present("V") {
println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
None
} else if !required_args_present {
eprintln!(
"{}: no variables specified\n\
@ -141,9 +144,6 @@ impl Args {
env!("CARGO_PKG_NAME")
);
None
} else if matches.opt_present("V") {
println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
None
} else {
let display_type = if matches.opt_present("N") {
DisplayType::Name