Auto-Completion in Mac OS X Terminal – custom word list

autocomplete, bash, macos, terminal

Solution

Here you go: http://freecode.com/projects/bashcompletion

You can install it via brew: `brew install bash-completion`. During installation brew will say what to do next - add some lines to your ~/.bash_profile:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
fi

Take a look at README for instructions on how to add custom completions

Problem

I would like to auto-complete the arguments in my function `foo`. I want to store a list of possible arguments like this: `bar,baba,gugu`. So when I type `foo b[TAB]`in Terminal, I would like to have the recommendations of `bar` and `baba`.

Original source