1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-21 03:41:57 +00:00
ohmyzsh/plugins/pj/pj.plugin.zsh

38 lines
594 B
Bash
Raw Normal View History

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