Add more validations
This commit is contained in:
parent
edd59e814b
commit
c802b56865
|
@ -44,23 +44,39 @@ checkParameters() {
|
||||||
}
|
}
|
||||||
|
|
||||||
getGitconfigData() {
|
getGitconfigData() {
|
||||||
displayDialogBox --yesno "Would you like to set up gitconfig?"
|
displayDialogBox --yesno "Would you like to set up gitconfig?" || return
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
displayDialogBox --msgbox "Now, I will ask you for data to set up gitconfig personal account."
|
displayDialogBox --msgbox "Now, I will ask you for data to set up gitconfig personal account."
|
||||||
gitPersonalName=$(displayDialogBox --inputbox "Enter a name." 3>&1 1>&2 2>&3)
|
gitPersonalName=$(displayDialogBox --inputbox "Enter a name." 3>&1 1>&2 2>&3)
|
||||||
gitPersonalMail=$(displayDialogBox --inputbox "Enter an e-mail." 3>&1 1>&2 2>&3)
|
gitPersonalMail=$(displayDialogBox --inputbox "Enter an e-mail." 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
displayDialogBox --msgbox "Let's continue with the work account."
|
while true; do
|
||||||
|
displayDialogBox --yesno "Please confirm that the data you entered is correct:\n\n - Name: ${gitPersonalName}\n - E-mail: ${gitPersonalMail}"
|
||||||
|
[ $? -eq 1 ] || break
|
||||||
|
gitPersonalName=$(displayDialogBox --inputbox "Enter a name." 3>&1 1>&2 2>&3)
|
||||||
|
gitPersonalMail=$(displayDialogBox --inputbox "Enter an e-mail." 3>&1 1>&2 2>&3)
|
||||||
|
done
|
||||||
|
|
||||||
|
displayDialogBox --yesno "Would you like to set up a work account?"
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
sed -e "s/PERSONAL_NAME/$gitPersonalName/g" -e "s/PERSONAL_MAIL/$gitPersonalMail/g" ./templates/.gitconfig-notwork > ./dotfiles/.gitconfig
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
gitWorkPath=$(displayDialogBox --inputbox "Enter an absolute folder path where you would like to use the work account." 3>&1 1>&2 2>&3)
|
gitWorkPath=$(displayDialogBox --inputbox "Enter an absolute folder path where you would like to use the work account." 3>&1 1>&2 2>&3)
|
||||||
while [[ ! -d $gitWorkPath ]]; do
|
while [[ ! -d $gitWorkPath ]]; do
|
||||||
gitWorkPath=$(displayDialogBox --no-cancel --inputbox "Path isn't valid. Please try again" 3>&1 1>&2 2>&3)
|
gitWorkPath=$(displayDialogBox --inputbox "Path isn't valid. Please try again" 3>&1 1>&2 2>&3)
|
||||||
done
|
done
|
||||||
gitWorkName=$(displayDialogBox --inputbox "Enter a name." 3>&1 1>&2 2>&3)
|
gitWorkName=$(displayDialogBox --inputbox "Enter a name." 3>&1 1>&2 2>&3)
|
||||||
gitWorkMail=$(displayDialogBox --inputbox "Enter an e-mail." 3>&1 1>&2 2>&3)
|
gitWorkMail=$(displayDialogBox --inputbox "Enter an e-mail." 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
displayDialogBox --yesno "Please confirm that the data you entered is correct:\n\n - Name: ${gitWorkName}\n - E-mail: ${gitWorkMail}"
|
||||||
|
[ $? -eq 1 ] || break
|
||||||
|
gitWorkName=$(displayDialogBox --inputbox "Enter a name." 3>&1 1>&2 2>&3)
|
||||||
|
gitWorkMail=$(displayDialogBox --inputbox "Enter an e-mail." 3>&1 1>&2 2>&3)
|
||||||
|
done
|
||||||
|
|
||||||
sed -e "s/PERSONAL_NAME/$gitPersonalName/g" -e "s/PERSONAL_MAIL/$gitPersonalMail/g" -e "s|WORK_PATH|${gitWorkPath}|g" ./templates/.gitconfig > ./dotfiles/.gitconfig
|
sed -e "s/PERSONAL_NAME/$gitPersonalName/g" -e "s/PERSONAL_MAIL/$gitPersonalMail/g" -e "s|WORK_PATH|${gitWorkPath}|g" ./templates/.gitconfig > ./dotfiles/.gitconfig
|
||||||
sed -e "s/WORK_NAME/$gitWorkName/g" -e "s/WORK_MAIL/$gitWorkMail/g" ./templates/.gitconfig-work > ./dotfiles/.gitconfig-work
|
sed -e "s/WORK_NAME/$gitWorkName/g" -e "s/WORK_MAIL/$gitWorkMail/g" ./templates/.gitconfig-work > ./dotfiles/.gitconfig-work
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[user]
|
||||||
|
name = PERSONAL_NAME
|
||||||
|
email = PERSONAL_MAIL
|
||||||
|
[commit]
|
||||||
|
gpgSign = false
|
||||||
|
[gc]
|
||||||
|
autoDetach = false
|
||||||
|
[filter "lfs"]
|
||||||
|
clean = git-lfs clean -- %f
|
||||||
|
smudge = git-lfs smudge -- %f
|
||||||
|
process = git-lfs filter-process
|
||||||
|
required = true
|
Loading…
Reference in New Issue