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:
parent
a6da379c5f
commit
fb97aab81f
@ -131,6 +131,9 @@ post_music() {
|
|||||||
|
|
||||||
# Post status with -p flag, command line.
|
# Post status with -p flag, command line.
|
||||||
post_status() {
|
post_status() {
|
||||||
|
if [[ "${1}" == "" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
local text="$@"
|
local text="$@"
|
||||||
visibility="${visibility:-public}"
|
visibility="${visibility:-public}"
|
||||||
local content_type="${content_type:-text/markdown}"
|
local content_type="${content_type:-text/markdown}"
|
||||||
@ -234,7 +237,7 @@ declare -A command=(
|
|||||||
[C]="Recreate default configuration file. Acquire new oauth token."
|
[C]="Recreate default configuration file. Acquire new oauth token."
|
||||||
[h]="Help, show usage information for ${0##*/}."
|
[h]="Help, show usage information for ${0##*/}."
|
||||||
[M]="Post the currently playing music track, requires playerctl."
|
[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."
|
[S]="Scrobble the currently playing music track, requires playerctl."
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -258,7 +261,7 @@ while getopts "${args}" i ; do
|
|||||||
post_music
|
post_music
|
||||||
exit 0;;
|
exit 0;;
|
||||||
p)
|
p)
|
||||||
post_status "${OPTARG}"
|
post_status "${OPTARG:-$(cat)}"
|
||||||
exit 0;;
|
exit 0;;
|
||||||
S)
|
S)
|
||||||
scrobble_music
|
scrobble_music
|
||||||
|
Loading…
Reference in New Issue
Block a user