Suggestion: do not use OptionParser.

Download and install my port of Damian Conway's Getopt::Declare (at
rubyforge.net).

You can then just write code as simple as:

require "Getopt/Declare"

args = Getopt::Declare.new(<<'EOPARAM')
	[pvtype: cmd  /start|stop/ ]
   -maintenance		Go into maintenance mode
   <cmd:cmd>		Begin/Stop script [required]
                        Use start or stop.
EOPARAM

print args.inspect

-------------------------------------------------
> test.rb
Error: required parameter '<cmd>' not found.

(try 'C:/ruby/learning/test.rb -help' for more information)

> test.rb -h

test.rb: version dated Mon Jul 12 21:55:16 Hora est. de Sudam?rica E. 2004

Usage: test.rb [options] <cmd>
       test.rb -help
       test.rb -version

Options:
   -maintenance         Go into maintenance mode
   <cmd>                Begin/Stop script
                        Use start or stop.

> test.rb start
<cmd> => "start"
Unused:

> test.rb -maintenance start
<cmd> => "start"
-maintenance => "-maintenance"
Unused: