mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 15:27:16 +00:00
fix(ignore_errors): Allow help and version command
This commit is contained in:
parent
d451e0a60c
commit
8103e9760a
2 changed files with 1 additions and 3 deletions
|
@ -3810,7 +3810,7 @@ impl Command {
|
|||
// do the real parsing
|
||||
let mut parser = Parser::new(self);
|
||||
if let Err(error) = parser.get_matches_with(&mut matcher, raw_args, args_cursor) {
|
||||
if self.is_set(AppSettings::IgnoreErrors) {
|
||||
if self.is_set(AppSettings::IgnoreErrors) && error.use_stderr() {
|
||||
debug!("Command::_do_parse: ignoring error: {error}");
|
||||
} else {
|
||||
return Err(error);
|
||||
|
|
|
@ -128,7 +128,6 @@ fn subcommand() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "`Result::unwrap_err()` on an `Ok` value")]
|
||||
fn help_command() {
|
||||
static HELP: &str = "\
|
||||
Usage: test
|
||||
|
@ -143,7 +142,6 @@ Options:
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "`Result::unwrap_err()` on an `Ok` value")]
|
||||
fn version_command() {
|
||||
let cmd = Command::new("test").ignore_errors(true).version("0.1");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue