From: Robert Klemme Date: 2009-10-12T18:18:31+09:00 Subject: Re: confuse with OptionParser -h opinion 2009/10/12 Zhenning Guan : > require 'optparse' > > options = {} > > optparse = OptionParser.new do|opts| >  opts.banner = "Usage: file1 file2 ..." >  opts.on( '-r', '--hhhh', 'screen' ) do >    puts opts >  end > >  opts.on( '-s', '--ssss', 'Display this screen' ) do >    puts opts >  end > >  opts.parse! > end > > ======= > ning@ning:~$ ruby xb.rb -h > Usage: file1 file2 ... >    -r, --hhhh                       screen >    -s, --ssss                       Display this screen > ======= > I use -h opinion, then it put out all opinion. but -h opinion doesn't > exit. > why this happened? can someone penlight me? Someone else defined it for you 11:17:16 desktop$ ruby19 -r optparse -e ' OptionParser.new.parse "-h"' Usage: -e [options] 11:17:42 desktop$ ruby19 -r optparse -e ' OptionParser.new.parse "-x"' -e:1:in `
': invalid option: -x (OptionParser::InvalidOption) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/