diff options
-rw-r--r-- | lib/optparse.rb | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -1639,7 +1639,7 @@ XXX # Non-option arguments remain in +argv+. # def order!(argv = default_argv, into: nil, &nonopt) - setter = ->(name, val = nil) {into[name.to_sym] = val} if into parse_in_order(argv, setter, &nonopt) end @@ -1665,8 +1665,8 @@ XXX end begin opt, cb, *val = sw.parse(rest, argv) {|*exc| raise(*exc)} - val = cb.call(*val) if cb - setter.call(sw.switch_name, *val) if setter rescue ParseError raise $!.set_option(arg, rest) end @@ -1704,8 +1704,8 @@ XXX end begin argv.unshift(opt) if opt and (!rest or (opt = opt.sub(/\A-*/, '-')) != '-') - val = cb.call(*val) if cb - setter.call(sw.switch_name, *val) if setter rescue ParseError raise $!.set_option(arg, arg.length > 2) end @@ -1731,6 +1731,17 @@ XXX end private :parse_in_order # # Parses command line arguments +argv+ in permutation mode and returns # list of non-option arguments. When optional +into+ keyword |