mirror of https://github.com/mitchell/dotfiles.git
Simplify and cleanup push functions
This commit is contained in:
parent
9d68c0103e
commit
e0ae2e0257
|
@ -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
|
|
@ -1,19 +0,0 @@
|
||||||
function send_push -a message -d 'Send a push notification to your phone via pushover (optional delay as second arg)'
|
|
||||||
if test -n "$argv[2]"
|
|
||||||
sleep $argv[2]
|
|
||||||
end
|
|
||||||
|
|
||||||
set payload \
|
|
||||||
"{
|
|
||||||
\"token\": \"$pushover_token\",
|
|
||||||
\"user\": \"$pushover_user\",
|
|
||||||
\"title\": \"Tasks\",
|
|
||||||
\"message\": $message
|
|
||||||
}"
|
|
||||||
|
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d $payload \
|
|
||||||
https://api.pushover.net/1/messages.json
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
function tasko -a id -d 'Open the link of a taskwarrior task by id'
|
|
||||||
set link (task _get $id.link)
|
|
||||||
if test -n $link
|
|
||||||
open $link
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
function tasktime -a id time -d 'Set a time to check-in on task progress using pushover'
|
|
||||||
set half_time (math $time/2)
|
|
||||||
set desc (task _get $id.description)
|
|
||||||
|
|
||||||
task $id start
|
|
||||||
|
|
||||||
fish -c "send_push '\"Half-time: $desc\"' $half_time" >/dev/null & disown
|
|
||||||
fish -c "send_push '\"Timer over: $desc\"' $time" >/dev/null & disown
|
|
||||||
end
|
|
|
@ -1,9 +0,0 @@
|
||||||
function taskwiki -a id
|
|
||||||
set page (task _get $id.wiki)
|
|
||||||
|
|
||||||
if test -n $page
|
|
||||||
$EDITOR +VimwikiIndex "+VimwikiGoto $page"
|
|
||||||
else
|
|
||||||
echo 'no wiki file specified'
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue