DanielKeep / cargo-script

Cargo script subcommand
Other
729 stars 37 forks source link

Updates clap to v2 #25

Closed kbknapp closed 8 years ago

kbknapp commented 8 years ago

This commit updates clap to v2.4.0 which contains a bunch of bug fixes and improvements. This PR also includes building clap with all default features as the old color feature is no longer built on Windows systems and therefore no longer an issue.

Besides the bump in version of clap, and associated simple name changes (of which only 3 affected this crate) such as add_all->args (etc.), the owned_vec_string function has been changed slightly to reflect claps returning an Iterator<Item=&str> instead of a Vec<&str>.


I was updating cargo-extras and since I'm not sure how to allow different [bin] tables to accept different major versions of a particular crate (clap in this case), this was one of the subcommands that needed an update to build cargo-extras.

The color feature shouldn't have a negative affect anymore since there are now cfg flags in place to ensure it doesn't do anything in Windows. But you may want to double check this real quick since I'm not typically a windows dev.

kbknapp commented 8 years ago

Whatyaknow, it exposed a bug. Once I get this fixed I'll re-open :stuck_out_tongue_winking_eye:

kbknapp commented 8 years ago

Turned out it wasn't a bug per-se. The issue was -dboolinator since it's declared as multiple(true) it was trying to parse the script as another value to -d.

The fix is simple, I added number_of_values(1) which says, -dval1 -dval2 -dval3 is valid but -dval1 val2 val3 isn't. I.e. now there's a distinction between multiple values, and multiple occurrences of an arg, and sometimes those two terms overlap a bit.