Skip to content

Commit

Permalink
refactor(parser): Clarify intent of split_arg_values
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jun 1, 2022
1 parent 7ce7885 commit 398bbd5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
// get the option so we can check the settings
let arg_values = matcher.pending_values_mut(id, None);
let arg = &self.cmd[id];
let parse_result = self.push_arg_values(
let parse_result = self.split_arg_values(
arg,
arg_os.to_value_os(),
trailing_values,
Expand Down Expand Up @@ -389,7 +389,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
}
let arg_values = matcher.pending_values_mut(&arg.id, Some(Identifier::Index));
let _parse_result =
self.push_arg_values(arg, arg_os.to_value_os(), trailing_values, arg_values);
self.split_arg_values(arg, arg_os.to_value_os(), trailing_values, arg_values);
if let Some(_parse_result) = _parse_result {
if _parse_result != ParseResult::ValuesDone {
debug!(
Expand Down Expand Up @@ -963,7 +963,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
debug!("Parser::parse_opt_value: has default_missing_vals");
for v in arg.default_missing_vals.iter() {
let trailing_values = false; // CLI should not be affecting default_missing_values
let _parse_result = self.push_arg_values(
let _parse_result = self.split_arg_values(
arg,
&RawOsStr::new(v),
trailing_values,
Expand Down Expand Up @@ -997,7 +997,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
}
} else if let Some(v) = attached_value {
let mut arg_values = Vec::new();
let parse_result = self.push_arg_values(arg, v, trailing_values, &mut arg_values);
let parse_result = self.split_arg_values(arg, v, trailing_values, &mut arg_values);
let react_result = self.react(
Some(ident),
ValueSource::CommandLine,
Expand Down Expand Up @@ -1026,16 +1026,16 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
}
}

fn push_arg_values(
fn split_arg_values(
&self,
arg: &Arg<'help>,
val: &RawOsStr,
trailing_values: bool,
output: &mut Vec<OsString>,
) -> Option<ParseResult> {
debug!("Parser::push_arg_values; arg={}, val={:?}", arg.name, val);
debug!("Parser::split_arg_values; arg={}, val={:?}", arg.name, val);
debug!(
"Parser::push_arg_values; trailing_values={:?}, DontDelimTrailingVals={:?}",
"Parser::split_arg_values; trailing_values={:?}, DontDelimTrailingVals={:?}",
trailing_values,
self.cmd.is_dont_delimit_trailing_values_set()
);
Expand Down Expand Up @@ -1254,7 +1254,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
);
let mut arg_values = Vec::new();
let _parse_result =
self.push_arg_values(arg, &val, trailing_values, &mut arg_values);
self.split_arg_values(arg, &val, trailing_values, &mut arg_values);
let _ = self.react(None, ValueSource::EnvVariable, arg, arg_values, matcher)?;
if let Some(_parse_result) = _parse_result {
if _parse_result != ParseResult::ValuesDone {
Expand Down Expand Up @@ -1324,7 +1324,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
// The flag occurred, we just want to add the val groups
let mut arg_values = Vec::new();
for v in arg.default_missing_vals.iter() {
let _parse_result = self.push_arg_values(
let _parse_result = self.split_arg_values(
arg,
&RawOsStr::new(v),
trailing_values,
Expand Down Expand Up @@ -1377,7 +1377,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
if add {
if let Some(default) = default {
let mut arg_values = Vec::new();
let _parse_result = self.push_arg_values(
let _parse_result = self.split_arg_values(
arg,
&RawOsStr::new(default),
trailing_values,
Expand Down Expand Up @@ -1416,7 +1416,7 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
debug!("Parser::add_default_value:iter:{}: wasn't used", arg.name);
let mut arg_values = Vec::new();
for v in arg.default_vals.iter() {
let _parse_result = self.push_arg_values(
let _parse_result = self.split_arg_values(
arg,
&RawOsStr::new(v),
trailing_values,
Expand Down

0 comments on commit 398bbd5

Please sign in to comment.