Merge pull request #80 from nnation/develop

PTMGitCommands.sh for Unix & Linux
This commit is contained in:
HojouFotytu 2019-02-26 10:45:08 +09:00 committed by GitHub
commit e7c0cdd651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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