diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-24 01:56:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-07-24 01:56:04 +0000 |
commit | 9af2d6fdf5ae9f3f67a7b21f5c4100ef3e189ad3 (patch) | |
tree | b9de5e17892d4a69acfe115f2ec3f93da03acaf8 /lib | |
parent | b53d4ed998c77c351cfdba228317d3493f253553 (diff) | |
download | ruby-9af2d6fdf5ae9f3f67a7b21f5c4100ef3e189ad3.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/optparse.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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 : []) |