Last active
August 29, 2015 14:10
-
-
Save grobie/ec9ee97d94987bee4094 to your computer and use it in GitHub Desktop.
golink
This file contains 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
function golink { | |
local organization=${2:-soundcloud} | |
local repository=${1} | |
local url=git@github.com:$organization/$repository.git | |
local src=$GOPATH/src/github.com/$organization/$repository | |
local dst=~/code/$repository | |
if [ ! -d $src ]; then | |
git clone $url $src | |
fi | |
if [ -d $src ]; then | |
ln -s $src $dst | |
else | |
echo golink: could not find $src >&2 | |
return 1 | |
fi | |
cd $dst | |
} |
This file contains 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
➜ golink ent | |
Cloning into '/home/ts/code/go/src/github.com/soundcloud/ent'... | |
remote: Counting objects: 136, done. | |
remote: Total 136 (delta 0), reused 0 (delta 0) | |
Receiving objects: 100% (136/136), 48.78 KiB | 0 bytes/s, done. | |
Resolving deltas: 100% (60/60), done. | |
Checking connectivity... done. | |
➜ ent git:(master) pwd | |
/home/ts/code/ent | |
➜ ent git:(master) pwd -L | |
/home/ts/code/ent | |
➜ ent git:(master) pwd -P | |
/home/ts/code/go/src/github.com/soundcloud/ent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment