diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2022-06-20 17:21:16 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2022-06-20 17:21:16 -0500 |
commit | dbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4 (patch) | |
tree | 3eefa5e0d6ce7e9b522daee907d6168f77fae426 | |
parent | 81d574b2ea7c88812e23661dd5f53c42e763f438 (diff) | |
download | git-config-profile-dbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4.tar.xz git-config-profile-dbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4.zip |
Add init command
-rwxr-xr-x | git-config-profile | 11 |
1 files changed, 10 insertions, 1 deletions
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 |