From: byrnejb on
I am trying, without success obviously, to check for a mandatory
argument switch using OptionParser. I have this code:

opts.on("-m", "--mapfile=FILE",
"Set data mapping file name",
" (default) '#{options.mapfile}'") do |file|
options.mapfile << file.strip

As far as I can tell, the absence of [] around the argument FILE
should make this a required switch. However, when I run the script
without any switches at all it does not raise a missing argument
error. Why not?

Does 'mandatory' refer only to the value supplied to a switch and not
to the presence or absence of the switch itself?

Pages: 1
Prev: sinatra
Next: Sending packets over TCP server