Project

General

Profile

Actions

Feature #11523

closed

optparse short options will match complete options

Added by mjrk (Micha J) over 9 years ago. Updated over 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:<unknown>]

Description

In short, if I define an option like "-F", "--irs [OCTAL]", -i will match this option, although the short version is defined as -F.


In long, this can be quite troublesome:

See the provided example

http://ruby-doc.org/stdlib-2.2.0/libdoc/optparse/rdoc/OptionParser.html

and change or remove the "-i", "--inplace [EXTENSION]" option for something else than i:

Now, the -i will still match, but the other option "-F", "--irs [OCTAL]"!

In a more complete stack this resulted in a hard to find error. Also, to fix this (and raise the required error) you need to check the ARGV directly which renders optparse a bit less useful.


Files

optparse-require-exact.patch (3.06 KB) optparse-require-exact.patch jeremyevans0 (Jeremy Evans), 07/01/2019 10:23 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0