Skip to content

Commit

Permalink
refactor(validator): Decouple parser
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Apr 21, 2022
1 parent 6229e78 commit 9d52301
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 72 deletions.
4 changes: 2 additions & 2 deletions src/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
#[cfg(feature = "env")]
self.add_env(matcher, trailing_values)?;
self.add_defaults(matcher, trailing_values);
return Validator::new(self).validate(parse_state, matcher);
return Validator::new(self.cmd).validate(parse_state, matcher);
} else {
// Start error processing
return Err(self.match_arg_error(&arg_os, valid_arg_found, trailing_values));
Expand All @@ -471,7 +471,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
#[cfg(feature = "env")]
self.add_env(matcher, trailing_values)?;
self.add_defaults(matcher, trailing_values);
Validator::new(self).validate(parse_state, matcher)
Validator::new(self.cmd).validate(parse_state, matcher)
}

fn match_arg_error(
Expand Down
Loading

0 comments on commit 9d52301

Please sign in to comment.