Skip to content

Commit 78a7962

Browse files
authored
Merge pull request #6243 from epage/term
fix(parser): Resolve regression with value_terminator/last
2 parents 21828f4 + af904ae commit 78a7962

File tree

2 files changed

+447
-110
lines changed

2 files changed

+447
-110
lines changed

clap_builder/src/parser/parser.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ impl<'cmd> Parser<'cmd> {
132132
self.cmd[opt].is_allow_hyphen_values_set())
133133
{
134134
// ParseResult::MaybeHyphenValue, do nothing
135-
} else if self.cmd.get_keymap().get(&pos_counter).is_some_and(|arg| {
136-
self.check_terminator(arg, arg_os.to_value_os()).is_some()
137-
}) {
138-
// Value terminator for this positional, let positional parsing handle it.
139135
} else {
140136
debug!("Parser::get_matches_with: setting TrailingVals=true");
137+
if self.cmd.get_keymap().get(&pos_counter).is_some_and(|arg| {
138+
self.check_terminator(arg, arg_os.to_value_os()).is_some()
139+
}) {
140+
// count as both an escape and terminator
141+
pos_counter += 1;
142+
}
141143
trailing_values = true;
142144
matcher.start_trailing();
143145
continue;

0 commit comments

Comments
 (0)