From: byrnejb Date: 2010-07-16T01:22:57+09:00 Subject: OptionParser mandatory versus optional arguments 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 end 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?