initial scripts

This commit is contained in:
= 2022-08-02 16:33:53 +02:00
parent 3ac456f888
commit 631fedb153
Signed by untrusted user who does not match committer: nickveliki
GPG Key ID: 9810EF8F924EDF0C
2 changed files with 34 additions and 0 deletions

7
.git-switch-user Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
profile=$1
name=$(git config -f ~/.git.d/$profile --get user.name )
email=$(git config -f ~/.git.d/$profile --get user.email )
echo "profile = $profile name = $name email = $email"
git config user.name = $name
git config user.email = $email

27
makeprofilealias.sh Normal file
View File

@ -0,0 +1,27 @@
#!bin/bash
profile=$(git config --global --get alias.profile | wc -l)
if [ $profile = "0" ]; then
git config --global alias.profile "!bash -c \"~/.git-switch-user \$1\""
else
echo "profile alias already defined in git"
fi
profileget=$(git config --global --get alias.profile-get | wc -l)
if [ $profileget = "0" ]; then
git config --global alias.profile-get "!bash -c \"git config -f ~/.git.d/\$1 --get \$2\""
else
echo "profile-get alias already defined in git"
fi
profileset=$(git config --global --get alias.profile-set | wc -l)
if [ $profileset = "0" ]; then
git config --global alias.profile-set "!bash -c \"git config -f ~/.git.d/\$1 \$2 \$3\""
else
echo "profile-set alias already defined in git"
fi
echo $(cat .git-switch-user) > ~/.git-switch-user
chmod +x ~/.git-switch-user
direx=$(ls ~/ -al| grep .git.d | wc -l)
if [ $direx = "0" ]; then
mkdir ~/.git.d
else
echo ".git.d already exists"
fi