mirror of https://github.com/mitchell/dotfiles.git
Refactor push_tasks and add send_push,timetask functions
This commit is contained in:
parent
5e8e764238
commit
2f5438dc21
|
@ -1,10 +1,4 @@
|
|||
function push_tasks -a token user -d 'Push tasks as a notification to your phone'
|
||||
function push_tasks -d 'Push tasks as a notification to your phone'
|
||||
set tasks (task +READY export | jq 'sort_by(.urgency) | reverse | map(@text "\(.description)\nLink: \(.link)") | join("\n\n")')
|
||||
set payload "{\"token\":\"$token\",\"user\":\"$user\",\"title\":\"Tasks\",\"message\":$tasks}"
|
||||
|
||||
curl \
|
||||
-X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d $payload \
|
||||
https://api.pushover.net/1/messages.json
|
||||
send_push $tasks
|
||||
end
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
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
|
|
@ -0,0 +1,9 @@
|
|||
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
|
Loading…
Reference in New Issue