generated from Templates/Baseline
fix argument passing
All checks were successful
All checks were successful
This commit is contained in:
parent
21c6ef703f
commit
183fc4b662
21
arkanum
21
arkanum
@ -243,13 +243,24 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setGitConfig() {
|
function setGitConfig() {
|
||||||
if [[ "$#" != "2" ]]; then
|
#echo "function arg counter is; $#"
|
||||||
sayE "Invalid arguments given. Please provide '<user>' and 'email'!" "Git"
|
#echo "function args:$@"
|
||||||
|
|
||||||
|
if [[ "$#" != "4" ]]; then
|
||||||
|
sayE "Invalid arguments given. Please provide '<user>' and '<email>'!" "Git"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ -z "$3" ]]; then
|
||||||
|
sayE "Invalid or empty username given!" "Git"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ -z "$4" ]]; then
|
||||||
|
sayE "Invalid or empty email given!" "Git"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
say "Setting global git config..." "Git"
|
say "Setting global git config..." "Git"
|
||||||
git config --global user.name "$1"
|
git config --global user.name "$3"
|
||||||
git config --global user.email "$2"
|
git config --global user.email "$4"
|
||||||
say "Returning global config:" "Git"
|
say "Returning global config:" "Git"
|
||||||
git config --list --global
|
git config --list --global
|
||||||
}
|
}
|
||||||
@ -287,7 +298,7 @@ function main() {
|
|||||||
elif [[ "$1" == "git" ]]; then
|
elif [[ "$1" == "git" ]]; then
|
||||||
# setup option
|
# setup option
|
||||||
if [[ "$2" == "setup" ]]; then
|
if [[ "$2" == "setup" ]]; then
|
||||||
setGitConfig "$3" "$4"
|
setGitConfig "$@"
|
||||||
else
|
else
|
||||||
sayE "Unknown option ($2) given for command 'git'!"
|
sayE "Unknown option ($2) given for command 'git'!"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user