* lib/optparse.rb: splat parsed arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
36e79167ab
commit
166ee9719f
@ -1,3 +1,7 @@
|
|||||||
|
Sun Sep 10 09:19:47 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/optparse.rb: splat parsed arguments.
|
||||||
|
|
||||||
Tue Jan 10 09:18:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Jan 10 09:18:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_require_safe): prevent extension from loading twice.
|
* eval.c (rb_require_safe): prevent extension from loading twice.
|
||||||
|
@ -1250,8 +1250,8 @@ class OptionParser
|
|||||||
raise $!.set_option(arg, true)
|
raise $!.set_option(arg, true)
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
|
opt, sw, *val = sw.parse(rest, argv) {|*exc| raise(*exc)}
|
||||||
sw.call(val) if sw
|
sw.call(*val) if sw
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, rest)
|
raise $!.set_option(arg, rest)
|
||||||
end
|
end
|
||||||
@ -1278,10 +1278,10 @@ class OptionParser
|
|||||||
raise $!.set_option(arg, true)
|
raise $!.set_option(arg, true)
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
opt, sw, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
|
opt, sw, *val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
|
||||||
raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}"
|
raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}"
|
||||||
argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-'
|
argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-'
|
||||||
sw.call(val) if sw
|
sw.call(*val) if sw
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, arg.length > 2)
|
raise $!.set_option(arg, arg.length > 2)
|
||||||
end
|
end
|
||||||
@ -1300,7 +1300,7 @@ class OptionParser
|
|||||||
nil
|
nil
|
||||||
}
|
}
|
||||||
|
|
||||||
visit(:search, :short, nil) {|sw| sw.block.call(argv) if !sw.pattern}
|
visit(:search, :short, nil) {|sw| sw.block.call(*argv) if !sw.pattern}
|
||||||
|
|
||||||
argv
|
argv
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user