* 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
This commit is contained in:
nobu 2003-12-20 07:07:19 +00:00
Родитель d4e661b4ad
Коммит 07507fe37a
2 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sat Dec 20 16:07:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <nobu@ruby-lang.org> Sat Dec 20 11:40:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/yaml.rb (YAML::YAML): adjust Marshal version. * lib/yaml.rb (YAML::YAML): adjust Marshal version.

Просмотреть файл

@ -80,7 +80,7 @@ Keyword completion module.
completion pattern. completion pattern.
=end #'#"#`# =end #'#"#`#
def complete(key, pat = nil) 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?) ignore_case?)
canon, sw, k, v, cn = nil canon, sw, k, v, cn = nil
candidates = [] candidates = []
@ -1034,7 +1034,7 @@ Default options, which never appear in option summary.
default_style = default_style.guess(arg = a) default_style = default_style.guess(arg = a)
default_pattern, conv = search(:atype, o) unless default_pattern default_pattern, conv = search(:atype, o) unless default_pattern
end end
ldesc << "--#{q}" ldesc << "--[no-]#{q}"
long << (o = q.downcase) long << (o = q.downcase)
not_pattern, not_conv = search(:atype, FalseClass) unless not_style not_pattern, not_conv = search(:atype, FalseClass) unless not_style
not_style = Switch::NoArgument not_style = Switch::NoArgument