title: Auto-complete command line arguments
body: <p>In bash, executables such as mplayer and imagemagick's "convert" have a cool auto-complete functionality on their command line arguments. For instance, if I type</p>
  
  <pre><code>mplayer &lt;tab&gt;&lt;tab&gt;
  </code></pre>
  
  <p>in one of my video folders, then mplayer will list all media files located in that folder, and only the media files.</p>
  
  <p>Similarly, if I type</p>
  
  <pre><code>convert -&lt;tab&gt;&lt;tab&gt;
  </code></pre>
  
  <p>then I will see all the possible options of the convert script, which is great.</p>
  
  <p>My question is how to achieve a similar functionality, using bash, ruby or python scripts?</p>