Created
March 18, 2013 14:42
-
-
Save apcomplete/5187630 to your computer and use it in GitHub Desktop.
bash script for being too lazy to cd into sites directory (with autocompletion)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_sites () { | |
local client project | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
if [ $prev == "sites" ] | |
then | |
COMPREPLY=( $(compgen -W "$(ls /Users/alex/Sites/)" -- $cur) ); | |
else | |
COMPREPLY=( $(compgen -W "$(ls "/Users/alex/Sites/$prev")" -- $cur)); | |
fi | |
} | |
complete -F _sites sites; | |
sites () { | |
cd "/Users/alex/Sites/$1/$2" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment