From: Nobuyoshi Nakada Date: 2008-02-20T13:36:07+09:00 Subject: Re: Need Help With OptionParser Hi, At Wed, 20 Feb 2008 10:00:17 +0900, Bryan Richardson wrote in [ruby-talk:291710]: > I'm wrapping a bunch of scripts with an command-line program, and I'm > wanting to use OptionParser to grab some of the options for the wrapper > application. Can anyone tell me if it's possible to rescue all the invalid > options for the wrapper application such that I can leave them in ARGV so > they're available to my scripts when I load them? OptionParser raises an OptionParser::InvalidOption, which has erred option in args. others = [] ARGV.options do |opt| opt.on("--foo=BAR") {|foo| puts "foo option #{foo}"} begin opt.parse! rescue OptionParser::InvalidOption => e others.concat(e.args) end end exec("your command", *ohters) -- Nobu Nakada