On Tuesday, July 13, 2004, 7:49:53 AM, Christian wrote:

> Hi,

> 	how can I parse options with OptionParser that are not prefixed
> by a "-x" or "--xxx"?

> My script should be called like:
> webserver.rb <options> <command>
> e.g.
> webserver.rb --maintenance start
> or
> webserver.rb start


OptionParser only concerns itself with -x and --xxx.  Anything else
(like 'start') will be left in ARGV after you have processed the
options.

So, given ARGV == ['--maintenance', 'start']

  parser = OptionParser.new do |p|
    p.on('--maintenance', ...) do { ... }
  end
  parser.parse!(ARGV)
  
  # Now ARGV == ['start']

Cheers,
Gavin