Improved handling for posts, now they can be piped through ratatoskr.sh -p. Also, with no pipe and no arguments, type your message and hit control+d when done to post.

This commit is contained in:
stormdragon2976 2023-02-01 02:02:18 -05:00
parent a6da379c5f
commit fb97aab81f

View File

@ -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