Add clone command
This commit is contained in:
parent
b876a21d27
commit
d77cda3a31
1 changed files with 19 additions and 0 deletions
19
bin/get
19
bin/get
|
|
@ -173,4 +173,23 @@ else
|
|||
fi
|
||||
;;
|
||||
|
||||
clone)
|
||||
# Github username, if available
|
||||
github_user=$(git config github.user)
|
||||
|
||||
# Turn "username/repo" into full Github URL
|
||||
if [[ "$2" =~ ^[^/]+/[^/]+$ ]]
|
||||
then
|
||||
url="https://github.com/$2"
|
||||
# Turn "repo" into "username/repo" Github URL
|
||||
elif [[ "$2" =~ ^[^/]+$ ]] && ! [ -z "$github_user" ]
|
||||
then
|
||||
url="https://github.com/${github_user}/$2"
|
||||
else
|
||||
url="$2"
|
||||
fi
|
||||
echo Cloning $url
|
||||
git clone "$url"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue