title: Don't parse options after the last positional argument
body: <p>I'm writing a wrapper around the <code>ssh</code> command line client. After the first positional argument that's part of <code>command</code>, all further options should also be treated as positional arguments.</p>
  
  <p>Under <code>optparse</code>, I believe this would be done with <a href="http://docs.python.org/py3k/library/optparse.html#optparse.OptionParser.disable_interspersed_args"><code>disable_interspersed_args</code></a>.</p>
  
  <p>Presently I have something like this:</p>
  
  <pre><code>parser = argparse.ArgumentParser()
  parser.add_argument('--parallel', default=False, action='store_true')
  # maybe allow no command? this would ssh interactively into each machine...
  parser.add_argument('command', nargs='+')
  args = parser.parse_args()
  </code></pre>
  
  <p>But if options are passed as part of the command (such as <code>my_wrapper ls -l</code>), they're instead interpreted by <code>ArgumentParser</code> as unknown options. <code>error: unrecognized arguments: -l</code></p>
  
  <p>If I use <a href="http://docs.python.org/py3k/library/argparse.html#argparse.ArgumentParser.parse_known_args"><code>parse_known_args()</code></a>, the options may be taken out of order. </p>
  
  <pre><code>p = argparse.ArgumentParser()
  p.add_argument('-a', action='store_true')
  p.add_argument('command', nargs='+')
  print(p.parse_known_args())
  
  $ python3 bah.py -b ls -l -a
  (Namespace(a=True, command=['ls']), ['-b', '-l'])
  </code></pre>
  
  <p>Here you can see that <code>-b</code>'s position before <code>ls</code> has been lost, and <code>-a</code> has been parsed out from the command, which is not desired.</p>
  
  <p>How can I:</p>
  
  <ul>
  <li>Prevent arguments from being parsed after a certain point?</li>
  <li>Disable parsing of interspersed arguments?</li>
  <li>Allow arguments with a prefix to be consumed as positional arguments?</li>
  </ul>