From 610785ef4023005e406715f306b5ccb85273d670 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Fri, 19 Apr 2019 15:09:19 -0400 Subject: [PATCH] Add gh_clone_repo function to cd to archive directory and clone given repo --- lib/login_functions.sh | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- 2.20.1