From: nobu@... Date: 2018-06-04T01:06:49+00:00 Subject: [ruby-core:87371] [Ruby trunk Misc#14812][Closed] Question: Option Parser Issue #14812 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Closed Just `rescue OptionParser::InvalidOption`. As it can't tell if an unknown option has its argument or not, I didn't add such methods. ```ruby require 'optparse' unknown = [] ARGV.options do |opt| opt.on("--foo=FOO") {|v| @foo = v} begin opt.order! {|arg| unknown << arg} rescue OptionParser::InvalidOption => e unknown.concat(e.args) redo end end p unknown p @foo ``` ---------------------------------------- Misc #14812: Question: Option Parser https://bugs.ruby-lang.org/issues/14812#change-72358 * Author: xz0r (xz0r xz0r) * Status: Closed * Priority: Normal * Assignee: ---------------------------------------- Hi, Is there an option / way to ignore undeclared options and get them in a resultset so, I can handle them in a custom way? Example scenario: Program A redirects unsupported arguments to another Program B called from inside program A. Thanks. -- https://bugs.ruby-lang.org/ Unsubscribe: