diff options
-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 |