From 3fe5d355a802d3212651a42eb6c54129cbf89b21 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 24 Jul 2017 01:56:04 +0000 Subject: optparse.rb: case-sensitive candidate * lib/optparse.rb (candidate): short options are case-sensitive by the default, should not match case-different options.. https://github.com/mernen/completion-ruby/pull/9#issuecomment-317287946 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/optparse.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/optparse.rb') diff --git a/lib/optparse.rb b/lib/optparse.rb index c38aec38be..05415901a3 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1744,16 +1744,16 @@ XXX def candidate(word) list = [] case word + when '-' + long = short = true when /\A--/ word, arg = word.split(/=/, 2) argpat = Completion.regexp(arg, false) if arg and !arg.empty? long = true - when /\A-(!-)/ - short = true when /\A-/ - long = short = true + short = true end - pat = Completion.regexp(word, true) + pat = Completion.regexp(word, long) visit(:each_option) do |opt| next unless Switch === opt opts = (long ? opt.long : []) + (short ? opt.short : []) -- cgit v1.2.3