Last active
January 29, 2019 15:30
-
-
Save hanshasselberg/f9925baae8a27e30be6e3bf3b1b19f6d to your computer and use it in GitHub Desktop.
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
# accepts git urls [email protected]:etcd-io/etcd.git | |
# accepts https urls https://github.com/etcd-io/etcd | |
function gclone | |
set url $argv | |
switch $url | |
case "git*" | |
set path (string replace -r "\.git\$" "" (string replace ":" "/" (string sub -s 5 $url))) | |
case "https://*" | |
set path (string sub -s 9 $url) | |
case '*' | |
echo 'please provide git or https url' | |
return 1 | |
end | |
mkdir -p $GOPATH/src/$path | |
git clone $url $GOPATH/src/$path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment