Only allow integers for input to github-apply

Remove some unneded code from github-remove
This commit is contained in:
Tony Murray
2017-02-17 21:49:29 -06:00
parent 6b33bdc949
commit 676e5563b9
2 changed files with 4 additions and 11 deletions

View File

@ -3,8 +3,7 @@
LIBRENMS_DIR=`dirname "$(readlink -f "$0/..")"`
cd $LIBRENMS_DIR
if [ -z "$1" ]; then
echo "You must specify a PR number to apply a patch"
else
curl https://patch-diff.githubusercontent.com/raw/librenms/librenms/pull/${1}.patch | git apply -v ${2}
fi
case $1 in
''|*[!0-9]*) echo "You must specify a PR number to apply a patch" ;;
*) curl -s https://patch-diff.githubusercontent.com/raw/librenms/librenms/pull/${1}.patch | git apply -v ${2} ;;
esac

View File

@ -18,7 +18,6 @@ def confirm(question):
sys.stdout.write("Please respond with 'yes' or 'no' (or 'y' or 'n').\n")
librenms_dir = dirname(dirname(abspath(__file__)))
parser = argparse.ArgumentParser()
@ -27,13 +26,8 @@ group.add_argument("-d", "--discard", action="store_true", help="Discard all cha
group.add_argument("-s", "--save", action="store_true", help="Save and remove changes by stashing them. (git stash)")
group.add_argument("-r", "--restore", action="store_true", help="Attempt to restore saved changes (git stash pop)")
parser.add_argument("-v", "--vendor", action="store_true", help="Also discard changes to ./vendor (requires --discard)")
args = parser.parse_args()
if args.vendor and not args.discard:
print(__file__ + ": error: argument -v/--vendor requires -d/--discard")
exit(1)
if args.discard:
if confirm("Are you sure you want to delete all modified and untracked files?"):