bash tab complete

random note on something that was hard to figure out:

bash tab complete using:

complete -C [commandtorun] [commandtocomplete] 

it will run the "commandtorun" command with three arguments.

  1. commandtocomplete
  2. the incomplete arg token at the prompt or "" for an empty token
  3. the arg token just before the incomplete token… which may be commandtocomplete if there are no intermediate args. 

Had to write an exe to write out the incoming args to a text file to figure this out.  the docs are a bit thin on the matter.

Leave a Reply