1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

7 commits

Author SHA1 Message Date
Nobuyoshi Nakada
5ad32d5504
LoadError is not a subclass of StandardError 2019-11-29 11:25:23 +09:00
MSP-Greg
71ffe40a44 test/optparse/test_did_you_mean.rb - fix suggestion order 2019-10-21 09:53:56 +09:00
Nobuyoshi Nakada
e2b719bed6
Support DidYouMean by AmbiguousOption too 2019-10-18 17:46:53 +09:00
Nobuyoshi Nakada
e29e49abf0
Default DidYouMean.formatter to PlainFormatter 2019-10-18 16:43:40 +09:00
Nobuyoshi Nakada
d4e52f672c
Added no suggestion test case 2019-10-18 15:19:26 +09:00
Nobuyoshi Nakada
46fa301e82
Use DidYouMean.formatter
Instead of building messages separately.
2019-10-18 15:18:36 +09:00
Yusuke Endoh
c3b64a86bc lib/optparse.rb: Show a did_you_mean hint for unknown option
```
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
```
2019-10-18 12:20:58 +09:00