From: merch-redmine@... Date: 2019-07-01T22:24:29+00:00 Subject: [ruby-core:93463] [Ruby master Bug#11523] optparse short options will match complete options Issue #11523 has been updated by jeremyevans0 (Jeremy Evans). Assignee set to nobu (Nobuyoshi Nakada) Status changed from Open to Assigned File optparse-require-exact.patch added I'm not sure I would consider this a bug, but I can definitely see it as an undesired feature in some cases. I think it would be worthwhile to add a way to turn off this feature, and require that options specified on the command line match exactly. Attached is a patch that adds a `require_exact` accessor that does this. ---------------------------------------- Bug #11523: optparse short options will match complete options https://bugs.ruby-lang.org/issues/11523#change-79012 * Author: mjrk (Micha J) * Status: Assigned * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * Target version: * ruby -v: 2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- 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) -- https://bugs.ruby-lang.org/ Unsubscribe: