Simplify and cleanup push functions

This commit is contained in:
mitchell 2021-02-16 09:46:24 -05:00
parent 9d68c0103e
commit e0ae2e0257
5 changed files with 25 additions and 43 deletions

View file

@ -0,0 +1,25 @@
function push -a message -d 'Send a push notification to your phone via pushover (optional delay as second arg)'
argparse 'u/url=' 'p/priority=' -- $argv
set -l host (cat /etc/hostname)
if test -z "$_flag_p"
set _flag_p '0'
end
set payload \
"{
\"token\": \"$pushover_token\",
\"user\": \"$pushover_user\",
\"title\": \"Push from $host\",
\"url\": \"$_flag_u\",
\"priority\": $_flag_p,
\"message\": \"$message\"
}"
curl \
-X POST \
-H 'Content-Type: application/json' \
-d "$payload" \
https://api.pushover.net/1/messages.json
end