title: Parsing arguments to a Java command line program
body: <p>What if I wanted to parse this:</p>
  
  <pre><code>java MyProgram -r opt1 -S opt2 arg1 arg2 arg3 arg4 --test -A opt3
  </code></pre>
  
  <p>And the result I want in my program is:</p>
  
  <pre><code>regular Java args[]  of size=4
  org.apache.commons.cli.Options[]  of size=3
  org.apache.commons.cli.Options[] #2 of size=1
  </code></pre>
  
  <p>I would prefer to use <a href="http://commons.apache.org/cli/" rel="noreferrer">Apache Commons CLI</a>, but the documentation is a little unclear about the case I present above.  Specifically, the documentation doesn't tell you how to handle options of the 3rd type I specify below:</p>
  
  <blockquote>
  <pre><code>1. options with a "-" char
  2. options with a "--" char
  3. options without any marker, or "bare args"
  </code></pre>
  </blockquote>
  
  <p>I wish that Apache Commons CLI would work but STILL be able to pass regular args to the program if those args didn't have a option prefix.  Maybe it does but the documentation doesnt say so as I read through it...</p>