Skip to content

Commit 43c1fa3

Browse files
committed
refactor(parser): Reduce code duplication
1 parent e5a7a65 commit 43c1fa3

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/parser/arg_matcher.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,11 @@ impl ArgMatcher {
153153
}
154154

155155
pub(crate) fn start_occurrence_of_arg(&mut self, arg: &Arg) {
156-
let id = arg.get_id().clone();
157-
debug!("ArgMatcher::start_occurrence_of_arg: id={:?}", id);
158-
let ma = self.entry(id).or_insert(MatchedArg::new_arg(arg));
159-
debug_assert_eq!(ma.type_id(), Some(arg.get_value_parser().type_id()));
160-
ma.set_source(ValueSource::CommandLine);
161-
ma.new_val_group();
156+
self.start_custom_arg(arg, ValueSource::CommandLine);
162157
}
163158

164159
pub(crate) fn start_occurrence_of_group(&mut self, id: Id) {
165-
debug!("ArgMatcher::start_occurrence_of_group: id={:?}", id);
166-
let ma = self.entry(id).or_insert(MatchedArg::new_group());
167-
debug_assert_eq!(ma.type_id(), None);
168-
ma.set_source(ValueSource::CommandLine);
169-
ma.new_val_group();
160+
self.start_custom_group(id, ValueSource::CommandLine);
170161
}
171162

172163
pub(crate) fn start_occurrence_of_external(&mut self, cmd: &crate::Command) {

0 commit comments

Comments
 (0)