From bf4eeab976c9675efbac6f0cbd6a5dda5965d3b4 Mon Sep 17 00:00:00 2001 From: Nathaniel Nation Date: Mon, 25 Feb 2019 14:31:59 -0500 Subject: [PATCH] PTMGitCommands.sh for Unix & Linux --- _Development/PTMGitCommands.sh | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 _Development/PTMGitCommands.sh diff --git a/_Development/PTMGitCommands.sh b/_Development/PTMGitCommands.sh new file mode 100644 index 0000000..b083b89 --- /dev/null +++ b/_Development/PTMGitCommands.sh @@ -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 +