From: Stephan Wehner Date: 2009-05-24T13:58:26+09:00 Subject: OptionParser: unexpected behaviour with -help I ran into some unexpected behaviour with the Ruby OptionParser class. When running this script (without any command line arguments) the output is as in the last, commented, line. -------------------------------------- require 'optparse' options = {} OptionParser.new do |opt| opt.on "--ex EXECUTABLE", String do |val| options[:ex] = val end opt.on "--headers" do |val| options[:headers] = val end opt.parse(%w( -help )) end puts options.inspect # Output is {:ex=>"lp", :headers=>true} -------------------------------------- I don't think that '-help' should be treated the same as '-h -ex lp' or '-h --ex lp'. In particular, '-help' may be a misspelling of the common '--help' option. Am I doing something wrong? Is there a way to avoid this? Thanks a lot, Stephan -- Posted via http://www.ruby-forum.com/.