| # ######################################################################### | |
| # This bash script adds tab-completion to buck. | |
| # | |
| # Testing it out without installing | |
| # ================================= | |
| # | |
| # To test out the completion without "installing" this, just run this file | |
| # directly, like so: | |
| # | |
| # . ~/path/to/bash_completion | |
| # | |
| # Note: There's a dot ('.') at the beginning of that command. | |
| # | |
| # After you do that, tab completion will immediately be made available in your | |
| # current Bash shell. It will not, however, be available next time you log in. | |
| # | |
| # Installing | |
| # ========== | |
| # | |
| # To install the completion, point to this file from your .bash_profile, like so: | |
| # | |
| # . ~/path/to/bash_completion | |
| # | |
| # Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile. | |
| # | |
| # The settings will take effect the next time you log in. | |
| # | |
| # Uninstalling | |
| # ============ | |
| # | |
| # To uninstall, just remove the line from your .bash_profile and .bashrc. | |
| # ######################################################################### | |
| _buck_sh() | |
| { | |
| local cur prev opts | |
| COMPREPLY=() | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| prev="${COMP_WORDS[COMP_CWORD-1]}" | |
| opts="audit build cache clean install project targets test uninstall" | |
| COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
| } | |
| complete -F _buck_sh buck |