From: Siraaj Khandkar Date: Fri, 19 Apr 2019 19:09:19 +0000 (-0400) Subject: Add gh_clone_repo function X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=610785ef4023005e406715f306b5ccb85273d670;hp=909ece30d234990d57526c444117f4d3f6ab3100;p=khome.git Add gh_clone_repo function to cd to archive directory and clone given repo --- diff --git a/lib/login_functions.sh b/lib/login_functions.sh index 29bc3e2..950eb6f 100644 --- a/lib/login_functions.sh +++ b/lib/login_functions.sh @@ -91,6 +91,15 @@ gh_clone_org() { gh_clone 'orgs' "$1" } +gh_clone_repo() { + gh_username=$(echo "$1" | awk -F / '"$1 == "https" && $3 == github.com" {print $4}') + gh_dir="${HOME}/Archives/Software/src/repos/remote/github.com/${gh_username}" + mkdir -p "$gh_dir" + cd "$gh_dir" || exit 1 + git clone "$1" + cd - || exit 1 +} + work_log_template() { cat << EOF $(date +%F)