title: Python CLI Framework and Argument Parsing with Tab Completion
body: <p>I am looking for a good module that is already out there for parsing arguments on custom CLI interfaces.  If you can imagine there is a CLI that gives you a prompt:</p>
  
  <pre><code>framework&gt; commands go here....
  </code></pre>
  
  <p>It starts to get tedious when you add in arguments, example:</p>
  
  <pre><code>framework&gt; command &lt;argument1&gt; &lt;argument2&gt; ...
  </code></pre>
  
  <p>I'd like to know if there is any sort of module that will not only make it easy to create these CLI interfaces, but one that has tab completion for each argument in a command chain.  I'm tired of reinventing the wheel each time I create something like this!</p>
  
  <pre><code>framework&gt; comma&lt;tab&gt;
  framework&gt; command arg&lt;tab&gt;
  framework&gt; command argument parame&lt;tab&gt;
  framework&gt; command argument parameter
  </code></pre>
  
  <p>You get the idea.  If there is no module already out there for this sort of thing, any suggestions on an elegant solution to creating something like this in a modularized fashion, it would be much appreciated.</p>
  
  <p>Please note that I do not want to parse arguments passed in through the parent process command shell (such as bash), I want to do the processing from within an infinite while loop within the script itself.  For example:</p>
  
  <pre><code>while (True):
      cmd = raw_input("framework&gt; ")
      framework.process_command(cmd)
  </code></pre>