|
|
@ -14,38 +14,35 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
function pj() {
|
|
|
|
function pj() {
|
|
|
|
cmd="cd"
|
|
|
|
cmd="cd"
|
|
|
|
file=$1
|
|
|
|
file=$1
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "open" == "$file" ]] then
|
|
|
|
if [[ "open" == "$file" ]] then
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
file=$*
|
|
|
|
file=$*
|
|
|
|
cmd=(${(s: :)EDITOR})
|
|
|
|
cmd=(${(s: :)EDITOR})
|
|
|
|
else
|
|
|
|
else
|
|
|
|
file=$*
|
|
|
|
file=$*
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for project in $PROJECT_PATHS; do
|
|
|
|
|
|
|
|
if [[ -d $project/$file ]] then
|
|
|
|
|
|
|
|
$cmd "$project/$file"
|
|
|
|
|
|
|
|
unset project # Unset project var
|
|
|
|
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
for project in $PROJECT_PATHS; do
|
|
|
|
echo "No such project $1"
|
|
|
|
if [[ -d $project/$file ]] then
|
|
|
|
|
|
|
|
$cmd "$project/$file"
|
|
|
|
|
|
|
|
unset project # Unset project var
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "No such project $1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
alias pjo="pj open"
|
|
|
|
alias pjo="pj open"
|
|
|
|
|
|
|
|
|
|
|
|
function _pj () {
|
|
|
|
function _pj () {
|
|
|
|
# might be possible to improve this using glob, without the basename trick
|
|
|
|
# might be possible to improve this using glob, without the basename trick
|
|
|
|
typeset -a projects
|
|
|
|
typeset -a projects
|
|
|
|
projects=($PROJECT_PATHS/*)
|
|
|
|
projects=($PROJECT_PATHS/*)
|
|
|
|
projects=$projects:t
|
|
|
|
projects=$projects:t
|
|
|
|
_arguments '*:file:($projects)'
|
|
|
|
_arguments '*:file:($projects)'
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
compdef _pj pj
|
|
|
|
compdef _pj pj
|
|
|
|