B
Ben Woodcroft
Hi,
I am trying to use the standard optionparser to read in some arguments,
but one of those arguments is an argument itself. Is this a bug?
opt.rb:
require 'optparse'
OptionParser.new do |opts|
opts.on('-a','--args [ARGUMENTS]',String,"arguments") {|v| puts "Found:
#{v}"}
end.parse!
EXPECTED:
$ ruby opt.rb -a "-d me"
Found: -d me
ACTUAL:
$ ruby opt.rb -a "-d me"
Found:
/usr/lib/ruby/1.8/optparse.rb:1445:in `complete': invalid option: -d me
(OptionParser::InvalidOption)
from /usr/lib/ruby/1.8/optparse.rb:1443:in `catch'
from /usr/lib/ruby/1.8/optparse.rb:1443:in `complete'
from /usr/lib/ruby/1.8/optparse.rb:1282:in `parse_in_order'
from /usr/lib/ruby/1.8/optparse.rb:1249:in `catch'
from /usr/lib/ruby/1.8/optparse.rb:1249:in `parse_in_order'
from /usr/lib/ruby/1.8/optparse.rb:1243:in `order!'
from /usr/lib/ruby/1.8/optparse.rb:1334:in `permute!'
from /usr/lib/ruby/1.8/optparse.rb:1355:in `parse!'
from opt.rb:3
I am trying to use the standard optionparser to read in some arguments,
but one of those arguments is an argument itself. Is this a bug?
opt.rb:
require 'optparse'
OptionParser.new do |opts|
opts.on('-a','--args [ARGUMENTS]',String,"arguments") {|v| puts "Found:
#{v}"}
end.parse!
EXPECTED:
$ ruby opt.rb -a "-d me"
Found: -d me
ACTUAL:
$ ruby opt.rb -a "-d me"
Found:
/usr/lib/ruby/1.8/optparse.rb:1445:in `complete': invalid option: -d me
(OptionParser::InvalidOption)
from /usr/lib/ruby/1.8/optparse.rb:1443:in `catch'
from /usr/lib/ruby/1.8/optparse.rb:1443:in `complete'
from /usr/lib/ruby/1.8/optparse.rb:1282:in `parse_in_order'
from /usr/lib/ruby/1.8/optparse.rb:1249:in `catch'
from /usr/lib/ruby/1.8/optparse.rb:1249:in `parse_in_order'
from /usr/lib/ruby/1.8/optparse.rb:1243:in `order!'
from /usr/lib/ruby/1.8/optparse.rb:1334:in `permute!'
from /usr/lib/ruby/1.8/optparse.rb:1355:in `parse!'
from opt.rb:3