From: mame@... Date: 2019-10-18T04:36:46+00:00 Subject: [ruby-core:95411] [Ruby master Feature#16256] A "did you mean" hint for OptionParser Issue #16256 has been updated by mame (Yusuke Endoh). Status changed from Assigned to Closed My patch was reviewed by @yuki24 and @nobu , and merged. Closing. ---------------------------------------- Feature #16256: A "did you mean" hint for OptionParser https://bugs.ruby-lang.org/issues/16256#change-82165 * Author: mame (Yusuke Endoh) * Status: Closed * 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>