From dbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4 Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Mon, 20 Jun 2022 17:21:16 -0500 Subject: Add init command --- git-config-profile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/git-config-profile b/git-config-profile index d4be154..a2f4a93 100755 --- a/git-config-profile +++ b/git-config-profile @@ -33,6 +33,7 @@ cmd() { PROFILES=() REQ_PROFILE="" +INIT_REPO="" PROFILES_FILE="/etc/default/git-config-profiles" config_profile() { @@ -49,6 +50,11 @@ config_profile() { if [[ -z "${REQ_PROFILE}" ]]; then PROFILES+=( "${profile}" ); elif [[ "${REQ_PROFILE}" = "${profile}" ]]; then + + if [[ -n "${INIT_REPO}" ]]; then + cmd git init + fi + cmd git config --local user.name "$name"; cmd git config --local user.email "$email"; @@ -67,7 +73,7 @@ get_profile() { } die_usage() { - die "Usage: $PROGRAM [get|list|config] (profile)"; + die "Usage: $PROGRAM [get|list|config|init] (profile)"; } if [[ "$#" -eq 1 && "$1" = "list" ]]; then @@ -78,6 +84,9 @@ elif [[ "$#" -eq 2 ]]; then if [[ "$1" = "config" ]]; then REQ_PROFILE="$2"; + elif [[ "$1" = "init" ]]; then + INIT_REPO=1; + REQ_PROFILE="$2"; else die_usage; fi -- cgit v1.2.3