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
4
NEWS
4
NEWS
|
@ -405,6 +405,8 @@ OptionParser::
|
||||||
|
|
||||||
* Now show "Did you mean?" for unknown option. [Feature #16256]
|
* Now show "Did you mean?" for unknown option. [Feature #16256]
|
||||||
|
|
||||||
|
test.rb:
|
||||||
|
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.on("-f", "--foo", "foo") {|v| }
|
opts.on("-f", "--foo", "foo") {|v| }
|
||||||
|
@ -412,6 +414,8 @@ OptionParser::
|
||||||
opts.on("-c", "--baz", "baz") {|v| }
|
opts.on("-c", "--baz", "baz") {|v| }
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
$ ruby test.rb --baa
|
$ ruby test.rb --baa
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
|
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue