PTMGitCommands.sh for Unix & Linux

This commit is contained in:
Nathaniel Nation 2019-02-25 14:31:59 -05:00
parent 62f2636a69
commit bf4eeab976
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#!/bin/bash
clear
## Compliments to David C. Rankin
## https://stackoverflow.com/questions/30182086/how-to-use-goto-statement-in-shell-script#answer-30182634
## array of menu entries
entries=( "Sync current Branch with Main Repo(This will remove all changes you made!)"
"Exit" )
## set prompt for select menu
PS3='Selection: '
function pause(){
echo "Press any key to continue..."
read -p "$*"
}
while [ "$menu" != "2" ]; do ## outer loop redraws menu each time
echo "PTMagic Git Commands"
echo "The following Commands are available:"
printf "\n\nMain Menu:\n\n" ## heading for menu
select choice in "${entries[@]}"; do ## select displays choices in array
case "$choice" in ## case responds to choice
"Sync current Branch with Main Repo(This will remove all changes you made!)" )
git remote add upstream https://github.com/PTMagicians/PTMagic.git
git fetch upstream
git checkout develop
git reset --hard upstream/develop
git push origin develop --force
git pull origin develop
break ## break returns control to outer loop
;;
"Exit" )
clear
exit 0 ## variable setting exit condition
break
;;
* )
echo "Invalid option"
pause
break
;;
esac
done
done