forked from extern/nushell
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:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user