|
|
|
@ -202,7 +202,7 @@ impl<'a> UsageParser<'a> {
|
|
|
|
|
"UsageParser::help: setting help...{}",
|
|
|
|
|
&self.usage[self.start..self.pos]
|
|
|
|
|
);
|
|
|
|
|
arg.help = Some(&self.usage[self.start..self.pos]);
|
|
|
|
|
arg.about = Some(&self.usage[self.start..self.pos]);
|
|
|
|
|
self.pos += 1; // Move to next byte to keep from thinking ending ' is a start
|
|
|
|
|
self.prev = UsageToken::Help;
|
|
|
|
|
}
|
|
|
|
@ -262,7 +262,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'f');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -271,7 +271,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "flag");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -280,7 +280,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "flag");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -289,7 +289,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'f');
|
|
|
|
|
assert_eq!(a.long.unwrap(), "flag");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -298,7 +298,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'f');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -307,7 +307,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "flag");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'f');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -316,7 +316,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "flag");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "flag");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'f');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -351,7 +351,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "f");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'f');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.val_names.is_none());
|
|
|
|
|
assert!(a.num_vals.is_none());
|
|
|
|
@ -377,7 +377,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -392,7 +392,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -407,7 +407,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -422,7 +422,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -437,7 +437,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -452,7 +452,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::Required));
|
|
|
|
@ -466,7 +466,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -481,7 +481,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -496,7 +496,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(a.is_set(ArgSettings::Required));
|
|
|
|
@ -510,7 +510,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -525,7 +525,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -540,7 +540,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -558,7 +558,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -573,7 +573,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -591,7 +591,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -606,7 +606,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::Required));
|
|
|
|
@ -620,7 +620,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -638,7 +638,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleValues));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
@ -653,7 +653,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(a.is_set(ArgSettings::Required));
|
|
|
|
@ -667,7 +667,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -686,7 +686,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -702,7 +702,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -721,7 +721,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -737,7 +737,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -756,7 +756,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -772,7 +772,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::Required));
|
|
|
|
@ -786,7 +786,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -805,7 +805,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -821,7 +821,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(a.is_set(ArgSettings::Required));
|
|
|
|
@ -835,7 +835,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -854,7 +854,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -873,7 +873,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -892,7 +892,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -908,7 +908,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -927,7 +927,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::Required));
|
|
|
|
@ -944,7 +944,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -963,7 +963,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(a.is_set(ArgSettings::Required));
|
|
|
|
@ -977,7 +977,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -996,7 +996,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1015,7 +1015,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1034,7 +1034,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1050,7 +1050,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1069,7 +1069,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(!a.is_set(ArgSettings::Required));
|
|
|
|
@ -1086,7 +1086,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1105,7 +1105,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "option");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(a.is_set(ArgSettings::MultipleOccurrences));
|
|
|
|
|
assert!(a.is_set(ArgSettings::TakesValue));
|
|
|
|
|
assert!(a.is_set(ArgSettings::Required));
|
|
|
|
@ -1119,7 +1119,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1138,7 +1138,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1157,7 +1157,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1176,7 +1176,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1195,7 +1195,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "myopt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1214,7 +1214,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "opt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1227,7 +1227,7 @@ mod test {
|
|
|
|
|
fn create_positional_usage() {
|
|
|
|
|
let a = Arg::from("[pos] 'some help info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1240,7 +1240,7 @@ mod test {
|
|
|
|
|
fn create_positional_usage0() {
|
|
|
|
|
let a = Arg::from("<pos> 'some help info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1253,7 +1253,7 @@ mod test {
|
|
|
|
|
fn pos_mult_help() {
|
|
|
|
|
let a = Arg::from("[pos]... 'some help info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1266,7 +1266,7 @@ mod test {
|
|
|
|
|
fn pos_help_lit_single_quote() {
|
|
|
|
|
let a = Arg::from("[pos]... 'some help\' info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help' info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help' info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1279,7 +1279,7 @@ mod test {
|
|
|
|
|
fn pos_help_double_lit_single_quote() {
|
|
|
|
|
let a = Arg::from("[pos]... 'some \'help\' info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some 'help' info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some 'help' info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1295,7 +1295,7 @@ mod test {
|
|
|
|
|
info'",
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help\ninfo");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help\ninfo");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1311,7 +1311,7 @@ mod test {
|
|
|
|
|
info'",
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help' stuff\ninfo");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help' stuff\ninfo");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1324,7 +1324,7 @@ mod test {
|
|
|
|
|
fn pos_req_mult_help() {
|
|
|
|
|
let a = Arg::from("<pos>... 'some help info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1361,7 +1361,7 @@ mod test {
|
|
|
|
|
fn pos_req_mult_def_help() {
|
|
|
|
|
let a = Arg::from("<pos>... @a 'some help info'");
|
|
|
|
|
assert_eq!(a.name, "pos");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
a.is_set(ArgSettings::MultipleValues) && a.is_set(ArgSettings::MultipleOccurrences)
|
|
|
|
|
);
|
|
|
|
@ -1377,7 +1377,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "o");
|
|
|
|
|
assert!(a.long.is_none());
|
|
|
|
|
assert_eq!(a.short.unwrap(), 'o');
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1397,7 +1397,7 @@ mod test {
|
|
|
|
|
assert_eq!(a.name, "myopt");
|
|
|
|
|
assert!(a.short.is_none());
|
|
|
|
|
assert_eq!(a.long.unwrap(), "opt");
|
|
|
|
|
assert_eq!(a.help.unwrap(), "some help info");
|
|
|
|
|
assert_eq!(a.about.unwrap(), "some help info");
|
|
|
|
|
assert!(
|
|
|
|
|
!(a.is_set(ArgSettings::MultipleValues) || a.is_set(ArgSettings::MultipleOccurrences))
|
|
|
|
|
);
|
|
|
|
@ -1415,21 +1415,21 @@ mod test {
|
|
|
|
|
fn nonascii() {
|
|
|
|
|
let a = Arg::from("<ASCII> 'üñíčöĐ€'");
|
|
|
|
|
assert_eq!(a.name, "ASCII");
|
|
|
|
|
assert_eq!(a.help, Some("üñíčöĐ€"));
|
|
|
|
|
assert_eq!(a.about, Some("üñíčöĐ€"));
|
|
|
|
|
let a = Arg::from("<üñíčöĐ€> 'ASCII'");
|
|
|
|
|
assert_eq!(a.name, "üñíčöĐ€");
|
|
|
|
|
assert_eq!(a.help, Some("ASCII"));
|
|
|
|
|
assert_eq!(a.about, Some("ASCII"));
|
|
|
|
|
let a = Arg::from("<üñíčöĐ€> 'üñíčöĐ€'");
|
|
|
|
|
assert_eq!(a.name, "üñíčöĐ€");
|
|
|
|
|
assert_eq!(a.help, Some("üñíčöĐ€"));
|
|
|
|
|
assert_eq!(a.about, Some("üñíčöĐ€"));
|
|
|
|
|
let a = Arg::from("-ø 'ø'");
|
|
|
|
|
assert_eq!(a.name, "ø");
|
|
|
|
|
assert_eq!(a.short, Some('ø'));
|
|
|
|
|
assert_eq!(a.help, Some("ø"));
|
|
|
|
|
assert_eq!(a.about, Some("ø"));
|
|
|
|
|
let a = Arg::from("--üñíčöĐ€ 'Nōṫ ASCII'");
|
|
|
|
|
assert_eq!(a.name, "üñíčöĐ€");
|
|
|
|
|
assert_eq!(a.long, Some("üñíčöĐ€"));
|
|
|
|
|
assert_eq!(a.help, Some("Nōṫ ASCII"));
|
|
|
|
|
assert_eq!(a.about, Some("Nōṫ ASCII"));
|
|
|
|
|
let a = Arg::from("[ñämê] --ôpt=[üñíčöĐ€] 'hælp'");
|
|
|
|
|
assert_eq!(a.name, "ñämê");
|
|
|
|
|
assert_eq!(a.long, Some("ôpt"));
|
|
|
|
@ -1437,6 +1437,6 @@ mod test {
|
|
|
|
|
a.val_names.unwrap().values().collect::<Vec<_>>(),
|
|
|
|
|
[&"üñíčöĐ€"]
|
|
|
|
|
);
|
|
|
|
|
assert_eq!(a.help, Some("hælp"));
|
|
|
|
|
assert_eq!(a.about, Some("hælp"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|