Bash Completion

##$ bash comp_TAB

I prefer like use command tool because it’s powerful but always can’t remember the sub parameters. Yeah, I hate the parameters, like git’s?

I finished the book ‘Pro Git’ on subway, WOW, today when i using git i remember a auto-complete tool can save me. It’s easy to copy the bash-complete.bash to home folder and configure to .bash_profile. then homebrew tell me a new version of git is here, so i ran upgrade and git tell me:

Bash completion has been installed to: /usr/local/etc/bash_completion.d
the folder has three files, then google how to use them, finally i got a power tools under:

https://github.com/mxcl/homebrew/blob/master/Library/Formula/bash-completion.rb

As the name, it’s bash-completion, the finally solution of auto complete and make works well.

###Install on OS X with brew

$ brew install bash-completion

$ mvim ~/.bash_profile

Add the 3 lines to the end of .bash_profile as introduction.

if [ -f `brew –prefix/etc/bash_completion ]; then .brew –prefix/etc/bash_completion fi
If you need brew up-, of course you need, run below line in bash.`

$ ln -s “/usr/local/Library/Contributions/brew_bash_completion.sh” “/usr/local/etc/bash_completion.d”

finally restart the shell to make sure the environment become effective or with

$ source ~/.bash_profile

###Try to start

now type brew up-, you will got the prompt with all parameters start with up.

bash-completion new support 185 items, include most common command like python, scala, npm…

###Reference:

http://bash-completion.alioth.debian.org/