summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Born <alex@velosgt.com>2022-07-08 00:43:12 -0500
committerAlex Born <alex@velosgt.com>2022-07-08 00:46:19 -0500
commitb762f9f2b2b5644718ce3e58a6e2c1a39efbcf02 (patch)
treeafa3eda8fb5e1181d0c53a2997f2ab0352436806
parentdbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4 (diff)
downloadgit-config-profile-main.tar.xz
git-config-profile-main.zip
Add ability to clone into current dirHEADmain
-rwxr-xr-xgit-config-profile14
1 files changed, 13 insertions, 1 deletions
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