Issue #16256 has been updated by shevegen (Robert A. Heiler).


\o/

----------------------------------------
Feature #16256: A "did you mean" hint for OptionParser
https://bugs.ruby-lang.org/issues/16256#change-82068

* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
----------------------------------------
How about showing "did you mean" when a unknown option is passed for OptionParser?

```ruby
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
```

https://github.com/ruby/ruby/pull/2561



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>