# ######################################################################### # This bash script adds a tab-completion feature to aspen. # # # Testing it out without installing # ================================= # # To test out the completion without "installing" this, just run this file # directly, like so: # # $ source ~/path/to/aspen_bash_completion # # After you do that, tab completion will immediately be made available in your # current Bash shell. But it won't be available next time you log in. # # # Installing # ========== # # To install this, point to this file from your .bash_profile, like so: # # $ source ~/path/to/aspen_bash_completion # # Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile. # # Settings will take effect the next time you log in. # # # Uninstalling # ============ # # To uninstall, just remove the line from your .bash_profile and .bashrc. # # # Credits # ======= # # This script was built with Django's as an example, and the GNU documentation: # # http://code.djangoproject.com/browser/django/tags/releases/0.95/extras/django_bash_completion # http://www.gnu.org/software/bash/manual/bashref.html#SEC112 _aspen_completion() { local cur opts actions COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" opts="--address --help --mode --root" actions="start status stop restart" if [[ ( ${COMP_CWORD} -eq 1 && ( ${COMP_WORDS[0]} == aspen ) ) ]] ; then case ${cur} in -*) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) action=$COMPREPLY return 0 ;; *) COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) ) action=$COMPREPLY return 0 ;; esac fi } complete -F _aspen_completion aspen