title: c console application auto-complete dynamic arguments
body: <p>I am looking for a method of having console auto complete - such that given an application like:</p>
  
  <pre><code>int main (int argc, char ** argv)
  {
    if (argc == 1) return EXIT_FAILURE;
    if (strcmp(argv[1], "good")==0) printf("good\n");
    if (strcmp(argv[1], "bad")==0) printf("bad\n");
    return EXIT_FAILURE;
  }
  </code></pre>
  
  <p>When running it, I would like pressing [tab] after the command, such that it would give me one of the possible useful options.  </p>
  
  <p>Example:</p>
  
  <pre><code>./a.out g[tab]
  </code></pre>
  
  <p>would auto complete to</p>
  
  <pre><code>./a.out good
  </code></pre>
  
  <p>I don't want to edit /etc/bash-completion.d/, I was hoping for a much stronger auto-complete, something like a function in the executable itself that would be called - perhaps so it could query a database for the list of possible options.  Or perhaps output a message letting you know what the options are.</p>
  
  <p>If you think this is simply totally impossible, let me know!</p>