On Sat, Jun 16, 2012 at 11:32 AM, Bartosz Dziewoński <[email protected]> wrote: > The non-flag command line arguments are left in ARGV after > OptionParser runs. So you would do something like > > if options[:p] == 'B' or options[:p] == 'C' > if ARGV.length != 0 > raise 'unexpected argument' > else > do_stuff ARGV[0] > end > end
Yes. Note that one has to use OptionParser#parse! in order to have it remove options from the command line. I usually do OptionParser.new do |opts| opts.on ... end.parse! ARGV Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- You received this message because you are subscribed to the Google Groups ruby-talk-google group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at https://groups.google.com/d/forum/ruby-talk-google?hl=en
