-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Description
I'm writing a proxy-like option parser using this library so I could parse a few new options in my parser, but redirect anything else that isn't know to the next command. It seems this use case is not supported yet.
As example, think in a wrapper for the minitest command.
class TestRunner
def self.run(argv)
new(argv).run
end
def initialize(argv)
@argv = argv
@options = {}
@parser = OptionParser.new do |parser|
parser.banner = "Usage: bin/test [path or build number]"
parser.on("--record-deprecations", "Record deprecations") do |r|
@options[:record_deprecations] = r
end
parser.on("--include-branch-commits", "Include branch commits") do |i|
@options[:include_branch_commits] = i
end
end
end
def run
@parser.parse(@argv)
env = {}
if @options[:record_deprecations]
env["RECORD_DEPRECATIONS"] = "true"
end
exec(env, "bin/rails", "test", *@argv)
end
when running bin/test some_file.rb --record-deprecations --seed 2345 currently I get:
invalid option: --seed (OptionParser::InvalidOption)
from bin/test:8:in `run'
from bin/test:94:in `<main>'
I want to just keep unknown options inside @argv like we do with unknown arguments.
skryukov
Metadata
Metadata
Assignees
Labels
No labels