私はこのコードを持っています:
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!
-g
強制的に引数を設定するにはどうすればよいですか? 指定されていない場合は、パラメーターが呼び出された場合に表示される使用方法メッセージをトリガーします。-h