Skip to content

Make OptionParser able to use negative numbers as positional arguments #259

Closed
wants to merge 2 commits into from

2 participants

@VorontsovIE

Look dicussion at http://bugs.ruby-lang.org/issues/7537
Now negative numerics are treated as options only if some numeric options were explicitly specified. Instead they are treated as positional arguments.

One possible incompatibility introduced. It can happen if one explicitly specified numeric option (e.g. -1) and option which takes unrequired argument (in form -p [VAL] and not in form -p=[VAL]).
Then old version treats -p -1 as two different options while new version treats -1 as VAL for -p option but not a separate option.
To restore old behavior one can either just use this options in different order: -1 -p or use declaration of option with equal sign: -p=[VAL].
Tests illustrate this case.

@zzak
Ruby Programming Language member
zzak commented Apr 5, 2013

Please continue discussion on Bug #7537 in redmine, thanks for the report and patch!

@zzak zzak closed this Apr 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.