diff options
author | Marc Cornellà <marc.cornella@live.com> | 2019-12-28 18:00:35 +0100 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2019-12-28 18:07:09 +0100 |
commit | 9bfcab7d10e216df9fe7110334a41cf2f802bace (patch) | |
tree | fa65d524e377c75a83146995e0538b880e238df5 /plugins/osx | |
parent | 31219c02463f1f57271a3d336b4c25b9902ca4ad (diff) | |
download | zsh-9bfcab7d10e216df9fe7110334a41cf2f802bace.tar.gz zsh-9bfcab7d10e216df9fe7110334a41cf2f802bace.tar.bz2 zsh-9bfcab7d10e216df9fe7110334a41cf2f802bace.zip |
osx: use return instead of exit in spotify function
Diffstat (limited to 'plugins/osx')
-rw-r--r-- | plugins/osx/spotify | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/osx/spotify b/plugins/osx/spotify index 6233d813d..663215a74 100644 --- a/plugins/osx/spotify +++ b/plugins/osx/spotify @@ -148,11 +148,11 @@ if [ $# = 0 ]; then else if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then echo "The Spotify application must be installed." - exit 1 + return 1 fi if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then - osascript -e 'tell application "Spotify" to activate' || exit 1 + osascript -e 'tell application "Spotify" to activate' || return 1 sleep 2 fi fi @@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do if [ -z "${CLIENT_ID}" ]; then cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}"; showAPIHelp; - exit 1; + return 1 fi if [ -z "${CLIENT_SECRET}" ]; then cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}"; showAPIHelp; - exit 1; + return 1 fi SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r'); SPOTIFY_PLAY_URI=""; @@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do cecho "Autorization failed, please check ${USER_CONFG_FILE}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" showAPIHelp - exit 1 + return 1 fi SPOTIFY_ACCESS_TOKEN=$( \ printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \ @@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do echo " vol down # Decreases the volume by 10%."; echo " vol [amount] # Sets the volume to an amount between 0 and 100."; echo " vol # Shows the current Spotify volume."; - exit 1; + return 1 fi osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; @@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do "help" ) showHelp; break ;; + * ) showHelp; - break; + return 1 ;; esac done |