Fixes #1427: Prints help message with -h switch (#1454)

For some commands like `which` -h flag would trigger an error asking for
missing required parameters instead of printing the help message as it
does with --help. This commit adds a check in the command parser to
avoid that.
This commit is contained in:
rabisg0
2020-03-10 22:29:50 +05:30
committed by GitHub
parent a2443fbe02
commit d1fcce0cd3
3 changed files with 12 additions and 6 deletions

View File

@ -74,11 +74,7 @@ impl Call {
pub fn switch_preset(&self, switch: &str) -> bool {
self.named
.as_ref()
.and_then(|n| n.get(switch))
.map(|t| match t {
NamedValue::PresentSwitch(_) => true,
_ => false,
})
.map(|n| n.switch_present(switch))
.unwrap_or(false)
}
}