Skip to content

Instantly share code, notes, and snippets.

@cloudrkt
Last active August 22, 2019 20:38
Show Gist options
  • Save cloudrkt/19f3ffc07d4334edbd8bc233fa878a85 to your computer and use it in GitHub Desktop.
Save cloudrkt/19f3ffc07d4334edbd8bc233fa878a85 to your computer and use it in GitHub Desktop.
Quick check and jump to project
# List of code projects
gpathsrc="$GOPATH/src"
repos=(add your project paths here seperated by space)
# np starts a new project in folder below and opends editor.
function np () {
REPO="SET YOUR DEFAULT PROJECT FOLDER HERE"
echo "Insert project description"
read reason
cd $gpathsrc/$REPO/;
mkdir $1 && cd $1
printf "# $1 \n\n $reason" >> readme.md
# Setup git
git init
touch .gitignore
git add .gitignore readme.md
# Then open in your favorite editor
code .
}
# list Go projects
lpp() {
ppath="$gpathsrc/"
for item in ${repos[*]}
do
ls $args "$@" $ppath$item
done
}
gpp() {
if [ -z "$1" ]; then
echo "Please provide directory name"
return
fi
for item in ${repos[*]}
do
if [ -d "$gpathsrc/$item/$1" ]; then
echo "Going to: $gpathsrc/$item/$1"
cd $gpathsrc/$item/$1
return
fi
done
echo "Could not find $1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment