From: Robert Klemme Date: 2012-06-17T06:22:34+09:00 Subject: Re: Help using optionparser On Sat, Jun 16, 2012 at 11:32 AM, Bartosz Dziewoński 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/