mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
6c715d1de8
commit
76c286d195
3 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Mon Dec 6 22:47:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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 <zn@mbf.nifty.com>
|
Mon Dec 6 19:00:48 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
* misc/rb_optparse.zsh: fix typos.
|
* misc/rb_optparse.zsh: fix typos.
|
||||||
|
|
|
@ -1549,6 +1549,7 @@ XXX
|
||||||
end
|
end
|
||||||
pat = Completion.regexp(word, true)
|
pat = Completion.regexp(word, true)
|
||||||
visit(:each_option) do |opt|
|
visit(:each_option) do |opt|
|
||||||
|
next unless Switch === opt
|
||||||
opts = (long ? opt.long : []) + (short ? opt.short : [])
|
opts = (long ? opt.long : []) + (short ? opt.short : [])
|
||||||
opts = Completion.candidate(word, true, pat, &opts.method(:each)).map(&:first) if pat
|
opts = Completion.candidate(word, true, pat, &opts.method(:each)).map(&:first) if pat
|
||||||
if /\A=/ =~ opt.arg
|
if /\A=/ =~ opt.arg
|
||||||
|
|
2
sample/optparse/opttest.rb
Normal file → Executable file
2
sample/optparse/opttest.rb
Normal file → Executable file
|
@ -18,7 +18,7 @@ ARGV.options do
|
||||||
opts.on_tail("common options:")
|
opts.on_tail("common options:")
|
||||||
|
|
||||||
# no argument, shows at tail
|
# 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
|
# mandatory argument
|
||||||
opts.on("-r", "--require=LIBRARY", String,
|
opts.on("-r", "--require=LIBRARY", String,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue