Skip to content

Commit

Permalink
Added -v|--version similar to PR hnarayanan#64 from @ericmarkmartin, …
Browse files Browse the repository at this point in the history
…but with a separate variable at the top of the script and both shpotify and spotify version
  • Loading branch information
davidem authored and davidem committed Jun 8, 2020
1 parent 6c35452 commit 01c1646
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ spotify toggle repeat Toggles repeat playback mode.
spotify list uri <format> <uri> List uri,title,artist and album of specific playlist, format in csv|tsv|text|html"
spotify list mine <format>* List 'my' playlists (uri, title, public), format in csv|tsv|texst|html";
echo " * Please note that this requires authentication via a browser."
* Please note that this requires authentication via a browser."
spotify -v | --verision Shows the shpotify and spotify versions.";
````

## Authors and contributing
Expand Down
12 changes: 12 additions & 0 deletions spotify
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

SHPOTIFY_VERSION="2.1.1_DM_fork"
USER_CONFIG_DEFAULTS="CLIENT_ID=\"\"\nCLIENT_SECRET=\"\"";
USER_CONFIG_FILE="${HOME}/.shpotify.cfg";
if ! [[ -f "${USER_CONFIG_FILE}" ]]; then
Expand Down Expand Up @@ -106,9 +107,16 @@ showHelp () {
echo;
echo " connect <device_id> # Connect and play music on another device. ID can be found with 'list devices'.";
fi
echo;
echo " -v | --version # Shows the shpotify and spotify versions.";
showAPIHelp
}

showVersion() {
cecho "shpotify.sh: $SHPOTIFY_VERSION";
cecho "spotify: `osascript -e 'get version of application "Spotify"'`"
}

cecho(){
bold=$(tput bold);
green=$(tput setaf 2);
Expand Down Expand Up @@ -629,6 +637,10 @@ while [ $# -gt 0 ]; do
"help" )
showHelp;
break ;;

"-v" | "--version" )
showVersion | column -t;
break ;;
* )
showHelp;
exit 1;
Expand Down

0 comments on commit 01c1646

Please sign in to comment.