summaryrefslogtreecommitdiff
path: root/lib/optparse.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r--lib/optparse.rb8
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 : [])