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
Updated by mame (Yusuke Endoh) about 5 years ago
- Status changed from Assigned to Closed
My patch was reviewed by @yuki24 (Yuki Nishijima) and @nobu (Nobuyoshi Nakada) , and merged. Closing.
Actions
Like0
Like0Like0