Bug #14728
Updated by xz0r (xz0r xz0r) over 7 years ago
`test.rb`
~~~ ruby
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: test.rb example.rb [options]"
opts.on("--verbose", "Run verbosely") do |v|
options[:verbose] = v
end
opts.on("--custom opts.on("-q","--custom MANDATORY", "custom") do |x|
options[:custom] = x
end
end.parse!
p options
~~~
If I run the above script as follows below is output:
$ ruby test.rb --custom --verbose
{:custom=>"--verbose"}
This is not the expected behaviour as `--verbose` should not be set as the option value.