Actions
Feature #16256
closedA "did you mean" hint for OptionParser
Description
How about showing "did you mean" when a unknown option is passed for OptionParser?
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
Actions
Like0
Like0Like0