From 76c286d19581e2339782e7c8b4744dd2cdb8df17 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 6 Dec 2010 13:47:19 +0000 Subject: [PATCH] * lib/optparse.rb (OptionParser#candidate): skip separators. * sample/optparse/opttest.rb: should not override --help. [ruby-dev:42690] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/optparse.rb | 1 + sample/optparse/opttest.rb | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) mode change 100644 => 100755 sample/optparse/opttest.rb diff --git a/ChangeLog b/ChangeLog index b9eb661289..4c5e9b5a9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Dec 6 22:47:15 2010 Nobuyoshi Nakada + + * lib/optparse.rb (OptionParser#candidate): skip separators. + + * sample/optparse/opttest.rb: should not override --help. + [ruby-dev:42690] + Mon Dec 6 19:00:48 2010 Kazuhiro NISHIYAMA * misc/rb_optparse.zsh: fix typos. diff --git a/lib/optparse.rb b/lib/optparse.rb index 6d9c46fd84..259aa06aa9 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1549,6 +1549,7 @@ XXX end pat = Completion.regexp(word, true) visit(:each_option) do |opt| + next unless Switch === opt opts = (long ? opt.long : []) + (short ? opt.short : []) opts = Completion.candidate(word, true, pat, &opts.method(:each)).map(&:first) if pat if /\A=/ =~ opt.arg diff --git a/sample/optparse/opttest.rb b/sample/optparse/opttest.rb old mode 100644 new mode 100755 index 9247af494f..ea3bc5ad46 --- a/sample/optparse/opttest.rb +++ b/sample/optparse/opttest.rb @@ -18,7 +18,7 @@ ARGV.options do opts.on_tail("common options:") # no argument, shows at tail - opts.on_tail("--help", "show this message") {puts opts; exit} + opts.on_tail("--usage", "show this message") {puts opts; exit} # mandatory argument opts.on("-r", "--require=LIBRARY", String,