[Bash-completion-devel] -option=word1|word2|word3

Igor Murzov intergalactic.anonymous at gmail.com
Sat Feb 9 21:28:39 UTC 2013


On Mon, 4 Feb 2013 11:01:48 +0100
"Dr. med. Christoph Gille" <christoph.gille at charite.de> wrote:

> I am new to this list and need help.
> 
> I am writing a bash completion for a program. The option -aligner=...
> takes one from a list of words.
> 
> For instance -aligner=t_coffee  -aligner=clustalw
> 
> It should work from version 3 to on newest bash.
> 
> Do you know a simple example of a script from where I could
> learn how to do it?

Start from reading "Programmable Completion" section in bash manual,
then proceed to `compgen' and `complete' builtin commands description.
If you plan to integrate your completion with bash-completion, then
there are plenty of example scripts for you to learn from in the
bash-completion distribution. If you don't want to depend on 
bash-completion, then I'd recommend to look into this completion:

 http://code.google.com/p/sbopkg/source/browse/trunk/src/usr/doc/contrib/sbopkg.bash

it's simple and quite clear.


-- Igor



More information about the Bash-completion-devel mailing list