title: Force mandatory command line argument using OptionParse in Ruby
body: <p>I have this code:</p>
  
  <pre><code>options = {}
  opt_parse = OptionParser.new do |opts|
    opts.banner = "Usage: example.rb [options]"
  
    opts.on("-g", "--grade [N]", "Grade") do |g|
      options[:grade] = g
    end
  
    opts.on_tail("-h", "--help", "Show this message") do
      puts opts
      exit
    end
  
  end
  opt_parse.parse!
  </code></pre>
  
  <p>How can I force to set <code>-g</code> argument? If it is not specified then trigger <em>usage</em> messages as would be shown if <code>-h</code> parameter was called.</p>