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?
--
Posted via http://www.ruby-forum.com/ .
Robert_K1
(Robert K.)
12 October 2009 09:18
2
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 `<main>': invalid option: -x (OptionParser::InvalidOption)
Kind regards
robert
···
2009/10/12 Zhenning Guan <g.zhen.ning@gmail.com>:
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?
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/