From: "chaye (Roi Illouz)" Date: 2013-04-22T00:23:36+09:00 Subject: [ruby-core:54493] [ruby-trunk - Bug #8306][Open] Bug In OptionParser accepted parsing Issue #8306 has been reported by chaye (Roi Illouz). ---------------------------------------- Bug #8306: Bug In OptionParser accepted parsing https://bugs.ruby-lang.org/issues/8306 Author: chaye (Roi Illouz) Status: Open Priority: High Assignee: Category: Target version: ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN program: require 'optparse' options = {} OptionParser.new do |opts| opts.on("-a", "--a_param A", "A") do |a| options[:a] = a end opts.on("-b", "--b_param B", "B") do |b| options[:b] = b end end.parse! puts options puts ARGV When adding ops with mandatory params running ./example.rb -a -b x options: {:a=>"-b"} ARGV: x Result should not be greedy -a with no param should raise an exception just like C getopts Using optional params instead of mandatory yields correct results. -- http://bugs.ruby-lang.org/