mirror of
https://github.com/Xevion/spotify-quickauth.git
synced 2025-12-06 01:16:25 -06:00
Add --stop and --keep flags
This commit is contained in:
26
run.sh
26
run.sh
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$OS" = "Windows_NT" ]; then
|
if [ "$OS" = "Windows_NT" ]; then
|
||||||
@@ -14,6 +13,23 @@ else
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Flags parsing
|
||||||
|
STOP=0
|
||||||
|
KEEP=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
-K|--keep)
|
||||||
|
# Keep the unzipped executable after running
|
||||||
|
KEEP=1
|
||||||
|
;;
|
||||||
|
-S|--stop)
|
||||||
|
# Don't run the executable after unzipping (also keeps it)
|
||||||
|
STOP=1
|
||||||
|
KEEP=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# Fetch the latest release download URL
|
# Fetch the latest release download URL
|
||||||
REPO="Xevion/spotify-quickauth"
|
REPO="Xevion/spotify-quickauth"
|
||||||
API_URL="https://api.github.com/repos/$REPO/releases/latest"
|
API_URL="https://api.github.com/repos/$REPO/releases/latest"
|
||||||
@@ -32,5 +48,9 @@ curl -Lso $EXECUTABLE.tar.gz $DOWNLOAD_URL
|
|||||||
tar -xvf $EXECUTABLE.tar.gz $EXECUTABLE 1>/dev/null
|
tar -xvf $EXECUTABLE.tar.gz $EXECUTABLE 1>/dev/null
|
||||||
rm $EXECUTABLE.tar.gz
|
rm $EXECUTABLE.tar.gz
|
||||||
chmod +x $EXECUTABLE
|
chmod +x $EXECUTABLE
|
||||||
trap "rm -f $EXECUTABLE" INT EXIT
|
if [ "$KEEP" -eq 0 ]; then
|
||||||
./$EXECUTABLE $@
|
trap "rm -f $EXECUTABLE" INT EXIT
|
||||||
|
fi
|
||||||
|
if [ "$STOP" -eq 0 ]; then
|
||||||
|
./$EXECUTABLE $@
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user