diff options
-rw-r--r-- | NEWS | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -405,18 +405,22 @@ OptionParser:: * Now show "Did you mean?" for unknown option. [Feature #16256] - require 'optparse' - OptionParser.new do |opts| - opts.on("-f", "--foo", "foo") {|v| } - opts.on("-b", "--bar", "bar") {|v| } - opts.on("-c", "--baz", "baz") {|v| } - end.parse! - - $ ruby test.rb --baa - Traceback (most recent call last): - test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption) - Did you mean? baz - bar + test.rb: + + require 'optparse' + OptionParser.new do |opts| + opts.on("-f", "--foo", "foo") {|v| } + opts.on("-b", "--bar", "bar") {|v| } + opts.on("-c", "--baz", "baz") {|v| } + end.parse! + + example: + + $ ruby test.rb --baa + Traceback (most recent call last): + test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption) + Did you mean? baz + bar Pathname:: |