diff --git a/ratatoskr.sh b/ratatoskr.sh index d29c7f4..47fd409 100755 --- a/ratatoskr.sh +++ b/ratatoskr.sh @@ -131,6 +131,9 @@ post_music() { # Post status with -p flag, command line. post_status() { + if [[ "${1}" == "" ]]; then + return + fi local text="$@" visibility="${visibility:-public}" local content_type="${content_type:-text/markdown}" @@ -234,7 +237,7 @@ declare -A command=( [C]="Recreate default configuration file. Acquire new oauth token." [h]="Help, show usage information for ${0##*/}." [M]="Post the currently playing music track, requires playerctl." - [p:]="Post from the command line, e.g. ${0##*/} -p \"hello world\"" + [p]="Post from the command line, e.g. ${0##*/} -p \"hello world\"" [S]="Scrobble the currently playing music track, requires playerctl." ) @@ -258,7 +261,7 @@ while getopts "${args}" i ; do post_music exit 0;; p) - post_status "${OPTARG}" + post_status "${OPTARG:-$(cat)}" exit 0;; S) scrobble_music