summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2022-06-20 17:21:16 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2022-06-20 17:21:16 -0500
commitdbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4 (patch)
tree3eefa5e0d6ce7e9b522daee907d6168f77fae426
parent81d574b2ea7c88812e23661dd5f53c42e763f438 (diff)
downloadgit-config-profile-dbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4.tar.xz
git-config-profile-dbd92590ff09a2a13a9a4b89b09e1dd50e0e2fe4.zip
Add init command
-rwxr-xr-xgit-config-profile11
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