mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* optparse.rb (OptionParser::Completion::convert): returned all
values not first one. * optparse.rb (OptionParser::Switch::parse): return values as is. * optparse.rb (OptionParser::order): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a85c65859
commit
e20d6139f4
2 changed files with 15 additions and 8 deletions
|
@ -1,4 +1,11 @@
|
||||||
Wed Aug 7 09:45:24 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Wed Aug 7 21:58:01 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
|
* optparse.rb (OptionParser::Completion::convert): returned all
|
||||||
|
values not first one.
|
||||||
|
|
||||||
|
* optparse.rb (OptionParser::Switch::parse): return values as is.
|
||||||
|
|
||||||
|
* optparse.rb (OptionParser::order): ditto.
|
||||||
|
|
||||||
* lib/optparse/uri.rb: require standard uri module. thanks to
|
* lib/optparse/uri.rb: require standard uri module. thanks to
|
||||||
Minero Aoki.
|
Minero Aoki.
|
||||||
|
|
|
@ -106,7 +106,7 @@ Keyword completion module.
|
||||||
Extracts the first element from result of
|
Extracts the first element from result of
|
||||||
((<OptionParser::Completion#complete>)).
|
((<OptionParser::Completion#complete>)).
|
||||||
=end #'#"#`#
|
=end #'#"#`#
|
||||||
def convert(opt = nil, *val)
|
def convert(opt = nil, val = nil, *)
|
||||||
val
|
val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -210,8 +210,8 @@ Individual switch class.
|
||||||
=end #'#"#`#
|
=end #'#"#`#
|
||||||
def parse(arg, *val)
|
def parse(arg, *val)
|
||||||
if block
|
if block
|
||||||
*val = conv.yield(*val) if conv
|
val = conv.yield(*val) if conv
|
||||||
return arg, block, *val
|
return arg, block, val
|
||||||
else
|
else
|
||||||
return arg, nil
|
return arg, nil
|
||||||
end
|
end
|
||||||
|
@ -1075,8 +1075,8 @@ Default options, which never appear in option summary.
|
||||||
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.yield(*val) if sw
|
sw.yield(val) if sw
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, rest)
|
raise $!.set_option(arg, rest)
|
||||||
end
|
end
|
||||||
|
@ -1102,10 +1102,10 @@ Default options, which never appear in option summary.
|
||||||
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.yield(*val) if sw
|
sw.yield(val) if sw
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, has_arg)
|
raise $!.set_option(arg, has_arg)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue