Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
9bfcab7d
Commit
9bfcab7d
authored
Dec 28, 2019
by
Marc Cornellà
Browse files
osx: use return instead of exit in spotify function
parent
31219c02
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/osx/spotify
View file @
9bfcab7d
...
@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
...
@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
else
else
if
[
!
-d
/Applications/Spotify.app
]
&&
[
!
-d
$HOME
/Applications/Spotify.app
]
;
then
if
[
!
-d
/Applications/Spotify.app
]
&&
[
!
-d
$HOME
/Applications/Spotify.app
]
;
then
echo
"The Spotify application must be installed."
echo
"The Spotify application must be installed."
exit
1
return
1
fi
fi
if
[
$(
osascript
-e
'application "Spotify" is running'
)
=
"false"
]
;
then
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
sleep
2
fi
fi
fi
fi
...
@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
...
@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
if
[
-z
"
${
CLIENT_ID
}
"
]
;
then
if
[
-z
"
${
CLIENT_ID
}
"
]
;
then
cecho
"Invalid Client ID, please update
${
USER_CONFIG_FILE
}
"
;
cecho
"Invalid Client ID, please update
${
USER_CONFIG_FILE
}
"
;
showAPIHelp
;
showAPIHelp
;
exit
1
;
return
1
fi
fi
if
[
-z
"
${
CLIENT_SECRET
}
"
]
;
then
if
[
-z
"
${
CLIENT_SECRET
}
"
]
;
then
cecho
"Invalid Client Secret, please update
${
USER_CONFIG_FILE
}
"
;
cecho
"Invalid Client Secret, please update
${
USER_CONFIG_FILE
}
"
;
showAPIHelp
;
showAPIHelp
;
exit
1
;
return
1
fi
fi
SHPOTIFY_CREDENTIALS
=
$(
printf
"
${
CLIENT_ID
}
:
${
CLIENT_SECRET
}
"
|
base64
|
tr
-d
"
\n
"
|tr
-d
'\r'
)
;
SHPOTIFY_CREDENTIALS
=
$(
printf
"
${
CLIENT_ID
}
:
${
CLIENT_SECRET
}
"
|
base64
|
tr
-d
"
\n
"
|tr
-d
'\r'
)
;
SPOTIFY_PLAY_URI
=
""
;
SPOTIFY_PLAY_URI
=
""
;
...
@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
...
@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
cecho
"Autorization failed, please check
${
USER_CONFG_FILE
}
"
cecho
"Autorization failed, please check
${
USER_CONFG_FILE
}
"
cecho
"
${
SPOTIFY_TOKEN_RESPONSE_DATA
}
"
cecho
"
${
SPOTIFY_TOKEN_RESPONSE_DATA
}
"
showAPIHelp
showAPIHelp
exit
1
return
1
fi
fi
SPOTIFY_ACCESS_TOKEN
=
$(
\
SPOTIFY_ACCESS_TOKEN
=
$(
\
printf
"
${
SPOTIFY_TOKEN_RESPONSE_DATA
}
"
\
printf
"
${
SPOTIFY_TOKEN_RESPONSE_DATA
}
"
\
...
@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
...
@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
echo
" vol down # Decreases the volume by 10%."
;
echo
" vol down # Decreases the volume by 10%."
;
echo
" vol [amount] # Sets the volume to an amount between 0 and 100."
;
echo
" vol [amount] # Sets the volume to an amount between 0 and 100."
;
echo
" vol # Shows the current Spotify volume."
;
echo
" vol # Shows the current Spotify volume."
;
exit
1
;
return
1
fi
fi
osascript
-e
"tell application
\"
Spotify
\"
to set sound volume to
$newvol
"
;
osascript
-e
"tell application
\"
Spotify
\"
to set sound volume to
$newvol
"
;
...
@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
...
@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
"help"
)
"help"
)
showHelp
;
showHelp
;
break
;;
break
;;
*
)
*
)
showHelp
;
showHelp
;
b
re
ak
;
re
turn
1
;
;
esac
esac
done
done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment