diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-07 13:00:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-07 13:00:10 +0000 |
commit | 3bb9224b5f091daeac09c8fc31bc8541909262e1 (patch) | |
tree | e8e08c033ce67c82797702891530ff296ee93d3e | |
parent | 95f37c83fb9a11ab750ef59845414fedccee6cce (diff) | |
download | ruby-3bb9224b5f091daeac09c8fc31bc8541909262e1.tar.gz ruby-3bb9224b5f091daeac09c8fc31bc8541909262e1.tar.xz ruby-3bb9224b5f091daeac09c8fc31bc8541909262e1.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@2694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/optparse.rb | 14 |
2 files changed, 15 insertions, 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 Minero Aoki. diff --git a/lib/optparse.rb b/lib/optparse.rb index e4f0998fc..f93000e85 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -106,7 +106,7 @@ Keyword completion module. Extracts the first element from result of ((<OptionParser::Completion#complete>)). =end #'#"#`# - def convert(opt = nil, *val) + def convert(opt = nil, val = nil, *) val end end @@ -210,8 +210,8 @@ Individual switch class. =end #'#"#`# def parse(arg, *val) if block - *val = conv.yield(*val) if conv - return arg, block, *val + val = conv.yield(*val) if conv + return arg, block, val else return arg, nil end @@ -1075,8 +1075,8 @@ Default options, which never appear in option summary. raise $!.set_option(arg, true) end begin - opt, sw, *val = sw.parse(rest, argv) {|*exc| raise(*exc)} - sw.yield(*val) if sw + opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)} + sw.yield(val) if sw rescue ParseError raise $!.set_option(arg, rest) end @@ -1102,10 +1102,10 @@ Default options, which never appear in option summary. raise $!.set_option(arg, true) end 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}" argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-' - sw.yield(*val) if sw + sw.yield(val) if sw rescue ParseError raise $!.set_option(arg, has_arg) end |