Issue #8120 has been reported by jpsember (Jeff Sember). ---------------------------------------- Bug #8120: OptionParser is not handling lists of arguments correctly https://bugs.ruby-lang.org/issues/8120 Author: jpsember (Jeff Sember) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin11.4.2] Only the first element in a list of arguments is being processed by OptionParser. With the following program: ----------------------------------------------------- require 'optparse' options = {} optparse = OptionParser.new do |opts| options[:list] = nil opts.on("-l","--list x,y,z", Array, "Example") do |list| options[:list] = list end end arg = "--list a b c".split optparse.parse(arg) puts options
on 2013-03-19 02:45
on 2013-03-19 17:54
Issue #8120 has been updated by drbrain (Eric Hodel). Category set to lib Status changed from Open to Rejected You must use commas and no whitespace when entering a list as in your second arguments to opts.on ---------------------------------------- Bug #8120: OptionParser is not handling lists of arguments correctly https://bugs.ruby-lang.org/issues/8120#change-37738 Author: jpsember (Jeff Sember) Status: Rejected Priority: Normal Assignee: Category: lib Target version: ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin11.4.2] Only the first element in a list of arguments is being processed by OptionParser. With the following program: ----------------------------------------------------- require 'optparse' options = {} optparse = OptionParser.new do |opts| options[:list] = nil opts.on("-l","--list x,y,z", Array, "Example") do |list| options[:list] = list end end arg = "--list a b c".split optparse.parse(arg) puts options
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.