From d77cda3a31960b00858c9703998fedd63548e39c Mon Sep 17 00:00:00 2001 From: William Hilton Date: Sat, 1 Aug 2015 01:29:27 -0400 Subject: [PATCH] Add clone command --- bin/get | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bin/get b/bin/get index 7a97bf4..a970902 100755 --- a/bin/get +++ b/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