mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Verbatim texts need more indent [ci skip]
And separate ruby script and executed example.
This commit is contained in:
parent
58e2ca31db
commit
9cb809cfef
1 changed files with 15 additions and 11 deletions
26
NEWS
26
NEWS
|
@ -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!
|
||||
test.rb:
|
||||
|
||||
$ ruby test.rb --baa
|
||||
Traceback (most recent call last):
|
||||
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
|
||||
Did you mean? baz
|
||||
bar
|
||||
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::
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue