commit 05d29409a92708547be79117ff458a628955d007
parent e7c01f921350ac7ec8b059f86e624898d3c40fb3
Author: gearsix <gearsix@tuta.io>
Date: Tue, 2 Feb 2021 15:20:30 +0000
fixed git-cfg
Diffstat:
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/git-cfg.sh b/src/git-cfg.sh
@@ -1,7 +1,19 @@
-#!/bin/sh
-# git-setcfg
+#!/usr/bin/env bash
+# git-cfg
# description: set git config user.name ($1) & user.email ($2) in current dir, defaults to using --local
-# ARGUMENTS: -g, --global = "git config --global ..."
+# ARGUMENTS: -g, --global = "git config --global ..." | -h, --help = prints help
+
+if [[ $1 == "--help" || $1 == "-h" ]]; then
+ echo "Usage: git-cfg [ARGUMENTS] [NAME] [EMAIL]"
+ echo ""
+ echo "shorthand script to set the user.name and user.email values in a git"
+ echo "config."
+ echo ""
+ echo "ARGUMENTS"
+ echo " -l, --local use 'git config --local (default)"
+ echo " -g, --global use 'git config --global'"
+ exit
+fi
global=0
if [[ $1 == "--global" || $1 == "-g" ]]; then
@@ -10,9 +22,7 @@ if [[ $1 == "--global" || $1 == "-g" ]]; then
fi
username=$1
-shift
useremail=$2
-shift
if [[ $global -eq 1 ]]; then
git config --global user.name "$username"