Last active
December 15, 2016 15:27
-
-
Save shtirlic/4702088 to your computer and use it in GitHub Desktop.
Simple oh-my-zsh plugin for projects management
This file contains hidden or 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
# 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