summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-06 02:01:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-06 02:01:23 +0000
commit3b6c91c7a5bcb8a937f3a7fa1d47238709067d6e (patch)
treed85170871bc382ba636cc7149f7255306a3c4ee1
parent9e1ea49dd3469c8d2a29f1f2d9b0de62b0591fc9 (diff)
downloadruby-3b6c91c7a5bcb8a937f3a7fa1d47238709067d6e.tar.gz
ruby-3b6c91c7a5bcb8a937f3a7fa1d47238709067d6e.tar.xz
ruby-3b6c91c7a5bcb8a937f3a7fa1d47238709067d6e.zip
* lib/optparse.rb (OptionParser::Completion#complete): default not to
ignore case on completion. [ruby-talk:84726] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/optparse.rb14
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d29ef79b..19f0748c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-Thu Nov 6 10:17:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Nov 6 11:01:19 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/stringio/stringio.c (strio_set_string, strio_reopen): check
tainted.
@@ -11,6 +11,9 @@ Thu Nov 6 10:17:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (proc_options): reserve searched script path in the
source file name table. [ruby-list:38765]
+ * lib/optparse.rb (OptionParser::Completion#complete): default not to
+ ignore case on completion. [ruby-talk:84726]
+
Wed Nov 5 23:49:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* sample/openssl/gen_csr.rb: there (at least) is a CA which does not
diff --git a/lib/optparse.rb b/lib/optparse.rb
index f0b97ba12..96609b219 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