diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-06 02:01:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-06 02:01:23 +0000 |
commit | 2a40bbeea09f2355544bc47ccc46cbe1951031df (patch) | |
tree | d85170871bc382ba636cc7149f7255306a3c4ee1 /lib/optparse.rb | |
parent | 4646ba6b2a8ff08a989a4c761a9b621343da9671 (diff) |
* lib/optparse.rb (OptionParser::Completion#complete): default not to
ignore case on completion. [ruby-talk:84726]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r-- | lib/optparse.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index f0b97ba12e..96609b219d 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -80,7 +80,8 @@ Keyword completion module. completion pattern. =end #'#"#`# def complete(key, pat = nil) - pat ||= Regexp.new('\A' + Regexp.quote(key).gsub(/\w+(?=.)/, '\&\w*'), true) + pat ||= Regexp.new('\A' + Regexp.quote(key).gsub(/\w+(?=.)/, '\&\w*'), + ignore_case?) canon, sw, k, v = nil each do |k, *v| (if Regexp === k @@ -109,6 +110,10 @@ Keyword completion module. def convert(opt = nil, val = nil, *) val end + + def ignore_case? + false + end end =begin private @@ -122,6 +127,11 @@ Map from option/keyword string to object with completion. class OptionMap < Hash include Completion end + class OptionCaseMap < OptionMap + def ignore_case? + true + end + end =begin @@ -383,7 +393,7 @@ summary feature. def initialize @atype = {} @short = OptionMap.new - @long = OptionMap.new + @long = OptionCaseMap.new @list = [] end |