title: Providing an argument that looks like an option (rails runner / OptionParser / optparse)
body: <p>I have a script <code>magic</code> which uses <code>rails runner</code> to invoke another script <code>magic-foo.rb</code>, which does it's own option parsing. Something like this:</p>
  
  
  
  <pre><code>exec("#rails", "runner", "#{some_path}/bin/magic-foo.rb", *arguments)
  </code></pre>
  
  <p>I want to expose the <code>--help</code> option from <code>magic-foo.rb</code> through <code>magic</code>, but <code>rails runner</code> consumes <code>--help</code> and dies with its own help message.</p>
  
  <p>How can I get an argument that <em>looks</em> like an option through the use of <code>OptionParser</code> in <code>runner.rb</code>? Alternativel, how else can I get <code>magic</code> to evaluate <code>magic-foo.rb</code> in the right rails context with the right arguments?</p>
  
  <p>Because an argument <code>--</code> is the standard way to say "don't process following arguments" I might expect an invocation like this to work: <code>rails runner .../magic-foo.rb -- [ARGS]</code>. Unfortunately it does not. </p>
  
  <hr>
  
  <p>Active version of rails runner: <a href="https://github.com/rails/rails/blob/880371ef2b4a2cb08f0c36ceba1eee41836bb739/railties/lib/rails/commands/runner.rb" rel="nofollow noreferrer">https://github.com/rails/rails/blob/880371ef2b4a2cb08f0c36ceba1eee41836bb739/railties/lib/rails/commands/runner.rb</a> .</p>