In stead of checking for `-o|-d` manually, `OptionParser` can make parameters mandatory.  http://ruby-doc.org/stdlib-1.8.7/libdoc/optparse/rdoc/OptionParser.html#method-i-make_switch