Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@shtirlic
Last active December 15, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shtirlic/4702088 to your computer and use it in GitHub Desktop.
Save shtirlic/4702088 to your computer and use it in GitHub Desktop.
Simple oh-my-zsh plugin for projects management
# Go to the project dir
prcd() {
project=$*
cd $PROJECTS_HOME/$project
}
# Create new project and cd in the project path and open ST
prnew() {
mkdir "$PROJECTS_HOME/$*" && cd "$PROJECTS_HOME/$*" && git init
}
# Delete project
prdel() {
project=$*
echo "$fg[red]Do you want to delete project:$reset_color$fg[green] $project $reset_color?"
read line
if [ "$line" = Y ] || [ "$line" = y ]; then
rm -fr $PROJECTS_HOME/$project
echo "$fg[red]Project $project destroyed.$reset_color"
else
echo "$fg[green]Project $project was left intact.$reset_color"
fi
}
_list_projects() {
compadd `ls -d -- $PROJECTS_HOME/*/ | while read i ; do basename "$i" ; done`
}
compdef _list_projects prcd
compdef _list_projects prdel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment