commit 9c67886a6988c8c67d12ed8bb01809e2bb0fe08e
parent 79eece7b28ad1b887f0d7f5589566e637fc5cc01
Author: gearsix <gearsix@tuta.io>
Date: Sun, 13 Mar 2022 17:43:13 +0000
bugfix in git-cfg; updated it to use sh
Diffstat:
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/nix/git-cfg.sh b/nix/git-cfg.sh
@@ -1,30 +1,32 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
# 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 ..." | -h, --help = prints help
-if [[ $1 = "--help" || $1 = "-h" ]]; then
+if [ $1 = "--help" ] || [ $1 = "-h" ]; then
echo "Usage: git-cfg [ARGUMENTS] [NAME] [EMAIL]"
- echo ""
+ echo ""
echo "shorthand script to set the user.name and user.email values in a git"
- echo "config."
- echo ""
+ echo "config."
+ echo ""
echo "ARGUMENTS"
- echo " -l, --local use 'git config --local (default)"
+ echo " -l, --local use 'git config --local (default)"
echo " -g, --global use 'git config --global'"
- exit
+ exit
fi
global=0
-if [[ $1 = "--global" || $1 = "-g" ]]; then
+if [ "$1" = "--global" ] || [ "$1" = "-g" ]; then
global=1
shift
+elif [ "$1" = "--local" ] || [ "$1" = "-l" ]; then
+ shift
fi
-username=$1
-useremail=$2
+username="$1"
+useremail="$2"
-if [[ $global -eq 1 ]]; then
+if [ $global -eq 1 ]; then
git config --global user.name "$username"
git config --global user.email "$useremail"
else