Add gh_clone_repo function
[khome.git] / lib / login_functions.sh
index 29bc3e2..950eb6f 100644 (file)
@@ -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)
This page took 0.032716 seconds and 4 git commands to generate.