-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of number_of_values
when displaying arg
#2701
Conversation
num_of_values
when displaying argnumber_of_values
when displaying arg
}; | ||
write!(f, "{}", sep)?; | ||
} | ||
if self.is_set(ArgSettings::TakesValue) || self.is_positional() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Positionals now always TakesValue
, so this can be simplified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is or
rather than and
. I guess it can't simplified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too late, but I think it can. If positionals always have TakesValue
set then you just need to check TakesValue
.
positional = true
takes_value = true
if takes_value || positional = true
if takes_value = true
positional = false
takes_value = true
if takes_value || positional = true
if takes_value = true
positional = false
takes_value = false
if takes_value || positional = false
if takes_value = false
positional = true
takes_value = false
# Impossible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XD sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shrug we all overlook things like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like I'm going to need to read this another time or two to double check that this makes sense,. If someone else does that and feels good, feel free to sign off without me.
src/build/arg/mod.rs
Outdated
} else { | ||
write!(f, "<{}>", self.name)?; | ||
/// Write the values such as <name1> <name2> | ||
pub fn display_arg_val<F, T, E>(arg: &Arg, mut write: F) -> Result<(), E> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn display_arg_val<F, T, E>(arg: &Arg, mut write: F) -> Result<(), E> | |
pub(crate) fn display_arg_val<F, T, E>(arg: &Arg, mut write: F) -> Result<(), E> |
Fixes #1571