From b762f9f2b2b5644718ce3e58a6e2c1a39efbcf02 Mon Sep 17 00:00:00 2001 From: Alex Born Date: Fri, 8 Jul 2022 00:43:12 -0500 Subject: Add ability to clone into current dir --- git-config-profile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/git-config-profile b/git-config-profile index a2f4a93..308897d 100755 --- a/git-config-profile +++ b/git-config-profile @@ -34,6 +34,7 @@ cmd() { PROFILES=() REQ_PROFILE="" INIT_REPO="" +CLONE_REPO="" PROFILES_FILE="/etc/default/git-config-profiles" config_profile() { @@ -53,6 +54,8 @@ config_profile() { if [[ -n "${INIT_REPO}" ]]; then cmd git init + elif [[ -n "${CLONE_REPO}" ]]; then + GIT_SSH_COMMAND="ssh -i ${ssh_key}" cmd git clone "${CLONE_REPO}" . fi cmd git config --local user.name "$name"; @@ -73,7 +76,7 @@ get_profile() { } die_usage() { - die "Usage: $PROGRAM [get|list|config|init] (profile)"; + die "Usage: $PROGRAM [get|list|config|init|clone] (profile) [url]"; } if [[ "$#" -eq 1 && "$1" = "list" ]]; then @@ -91,6 +94,15 @@ elif [[ "$#" -eq 2 ]]; then die_usage; fi +elif [[ "$#" -eq 3 ]]; then + + if [[ "$1" = "clone" ]]; then + REQ_PROFILE="$2" + CLONE_REPO="$3" + else + die_usage; + fi + else die_usage; fi -- cgit v1.2.3