From: "Shareef J." Date: 2013-03-04T20:05:04+09:00 Subject: Re: Is it possible to use OptionParser with short options such as -oo? Actually, with minimal hacking I've managed to get it to do what I want. Here's the patch file for anyone interested. I'm running 1.9.2. $ cat optparse.patch --- optparse.rb 2013-03-04 10:58:37.789740398 +0000 +++ optparse.rb.modified 2013-03-04 10:55:44.866359326 +0000 @@ -1154,6 +1154,15 @@ end sdesc << "-#{q}" short << Regexp.new(q) + when /^-(.\S)(.+)?/ + q, a = $1, $2 + if a + o = notwice(NilClass, klass, 'type') + default_style = default_style.guess(arg = a) + default_pattern, conv = search(:atype, o) unless default_pattern + end + sdesc << "-#{q}" + short << q when /^-(.)(.+)?/ q, a = $1, $2 if a @@ -1281,7 +1290,7 @@ end # short option - when /\A-(.)((=).*|.+)?/m + when /\A-(.(?:.)?)((=).*|.+)?/m opt, has_arg, eq, val, rest = $1, $3, $3, $2, $2 begin sw, = search(:short, opt) -- Posted via http://www.ruby-forum.com/.