12345678910111213141516171819202122232425262728293031323334353637 |
- alias pjo="pj open"
- pj () {
- emulate -L zsh
- cmd="cd"
- project=$1
- if [[ "open" == "$project" ]]; then
- shift
- project=$*
- cmd=${=EDITOR}
- else
- project=$*
- fi
- for basedir ($PROJECT_PATHS); do
- if [[ -d "$basedir/$project" ]]; then
- $cmd "$basedir/$project"
- return
- fi
- done
- echo "No such project '${project}'."
- }
- _pj () {
- emulate -L zsh
- typeset -a projects
- for basedir ($PROJECT_PATHS); do
- projects+=(${basedir}/*(/N))
- done
- compadd ${projects:t}
- }
- compdef _pj pj
|