[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

OptionParser doesn't work like I expect?!

Asfand Yar Qazi

3/10/2005 6:51:00 PM

Hi,

Observe the following:

ruby -e 'require "optparse"; o = OptionParser.new do |o| o.on("-c=C",
"desc") {|c|} end; o.parse([]); '

(Note the wrapping - it should all be on one line.)

Why doesn't this raise an error? I'm expecting -c to be a compulsory
argument, but OptionParser doesn't seem to mind (when it should, I
thought.)

How do I make OptionParser raise an error if it doesn't receive a '-c'
argument?