mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-15 16:57:08 +00:00
Change a bunch of variable names
This commit is contained in:
parent
9bbe2d9816
commit
c41005a121
@ -81,7 +81,6 @@ fn parse<'a>(args: Args, inputs: &'a [OsString]) -> Result<Matches<'a>, ParseErr
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut iter = inputs.iter();
|
let mut iter = inputs.iter();
|
||||||
|
|
||||||
while let Some(arg) = iter.next() {
|
while let Some(arg) = iter.next() {
|
||||||
let bytes = arg.as_bytes();
|
let bytes = arg.as_bytes();
|
||||||
|
|
||||||
@ -92,20 +91,20 @@ fn parse<'a>(args: Args, inputs: &'a [OsString]) -> Result<Matches<'a>, ParseErr
|
|||||||
parsing = false;
|
parsing = false;
|
||||||
}
|
}
|
||||||
else if bytes.starts_with(b"--") {
|
else if bytes.starts_with(b"--") {
|
||||||
let long_arg = OsStr::from_bytes(&bytes[2..]);
|
let long_arg_name = OsStr::from_bytes(&bytes[2..]);
|
||||||
|
|
||||||
if let Some((before, after)) = split_on_equals(long_arg) {
|
if let Some((before, after)) = split_on_equals(long_arg_name) {
|
||||||
let &Arg { short: _, long: long_arg_name, takes_value } = args.lookup_long(before)?;
|
let arg = args.lookup_long(before)?;
|
||||||
let flag = Flag::Long(long_arg_name);
|
let flag = Flag::Long(arg.long);
|
||||||
match takes_value {
|
match arg.takes_value {
|
||||||
Necessary => results.flags.push((flag, Some(after))),
|
Necessary => results.flags.push((flag, Some(after))),
|
||||||
Forbidden => return Err(ParseError::ForbiddenValue { flag })
|
Forbidden => return Err(ParseError::ForbiddenValue { flag })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let &Arg { short: _, long: long_arg_name, takes_value } = args.lookup_long(long_arg)?;
|
let arg = args.lookup_long(long_arg_name)?;
|
||||||
let flag = Flag::Long(long_arg_name);
|
let flag = Flag::Long(arg.long);
|
||||||
match takes_value {
|
match arg.takes_value {
|
||||||
Forbidden => results.flags.push((flag, None)),
|
Forbidden => results.flags.push((flag, None)),
|
||||||
Necessary => {
|
Necessary => {
|
||||||
if let Some(next_arg) = iter.next() {
|
if let Some(next_arg) = iter.next() {
|
||||||
@ -122,9 +121,9 @@ fn parse<'a>(args: Args, inputs: &'a [OsString]) -> Result<Matches<'a>, ParseErr
|
|||||||
let short_arg = OsStr::from_bytes(&bytes[1..]);
|
let short_arg = OsStr::from_bytes(&bytes[1..]);
|
||||||
if let Some((before, after)) = split_on_equals(short_arg) {
|
if let Some((before, after)) = split_on_equals(short_arg) {
|
||||||
// TODO: remember to deal with the other bytes!
|
// TODO: remember to deal with the other bytes!
|
||||||
let &Arg { short, long, takes_value } = args.lookup_short(*before.as_bytes().last().unwrap())?;
|
let arg = args.lookup_short(*before.as_bytes().last().unwrap())?;
|
||||||
let flag = Flag::Short(short.unwrap());
|
let flag = Flag::Short(arg.short.unwrap());
|
||||||
match takes_value {
|
match arg.takes_value {
|
||||||
Necessary => results.flags.push((flag, Some(after))),
|
Necessary => results.flags.push((flag, Some(after))),
|
||||||
Forbidden => return Err(ParseError::ForbiddenValue { flag })
|
Forbidden => return Err(ParseError::ForbiddenValue { flag })
|
||||||
}
|
}
|
||||||
@ -133,9 +132,9 @@ fn parse<'a>(args: Args, inputs: &'a [OsString]) -> Result<Matches<'a>, ParseErr
|
|||||||
for byte in &bytes[1..] {
|
for byte in &bytes[1..] {
|
||||||
// TODO: gotta check that these don't take arguments
|
// TODO: gotta check that these don't take arguments
|
||||||
// like -c4
|
// like -c4
|
||||||
let &Arg { short, long, takes_value } = args.lookup_short(*byte)?;
|
let arg = args.lookup_short(*byte)?;
|
||||||
let flag = Flag::Short(*byte);
|
let flag = Flag::Short(*byte);
|
||||||
match takes_value {
|
match arg.takes_value {
|
||||||
Forbidden => results.flags.push((flag, None)),
|
Forbidden => results.flags.push((flag, None)),
|
||||||
Necessary => {
|
Necessary => {
|
||||||
if let Some(next_arg) = iter.next() {
|
if let Some(next_arg) = iter.next() {
|
||||||
|
Loading…
Reference in New Issue
Block a user