From 07507fe37a01b461b5feb9f4c16dafe2f1276f28 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 20 Dec 2003 07:07:19 +0000 Subject: [PATCH] * lib/optparse.rb (OptionParser::Completion::complete): wrong Regexp for word boundary. pointed out by Gavin Sinclair. * lib/optparse.rb (OptionParser::make_switch): [no-] prefix was missing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ lib/optparse.rb | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4293bf37cf..f6563f6a7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Dec 20 16:07:14 2003 Nobuyoshi Nakada + + * lib/optparse.rb (OptionParser::Completion::complete): wrong + Regexp for word boundary. pointed out by Gavin Sinclair. + + * lib/optparse.rb (OptionParser::make_switch): [no-] prefix was + missing. + Sat Dec 20 11:40:10 2003 Nobuyoshi Nakada * lib/yaml.rb (YAML::YAML): adjust Marshal version. diff --git a/lib/optparse.rb b/lib/optparse.rb index 50da8b329d..af512e2795 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -80,7 +80,7 @@ Keyword completion module. completion pattern. =end #'#"#`# def complete(key, pat = nil) - pat ||= Regexp.new('\A' + Regexp.quote(key).gsub(/\w+(?=.)/, '\&\w*'), + pat ||= Regexp.new('\A' + Regexp.quote(key).gsub(/\w+\b/, '\&\w*'), ignore_case?) canon, sw, k, v, cn = nil candidates = [] @@ -1034,7 +1034,7 @@ Default options, which never appear in option summary. default_style = default_style.guess(arg = a) default_pattern, conv = search(:atype, o) unless default_pattern end - ldesc << "--#{q}" + ldesc << "--[no-]#{q}" long << (o = q.downcase) not_pattern, not_conv = search(:atype, FalseClass) unless not_style not_style = Switch::NoArgument