Skip to content

Instantly share code, notes, and snippets.

@pjf
Created April 8, 2018 09:24
Show Gist options
  • Save pjf/308020b4ac3f3f9cdb45fca68ada8813 to your computer and use it in GitHub Desktop.
Save pjf/308020b4ac3f3f9cdb45fca68ada8813 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Head to the bugwarrior directory, since we'll be using a venv there
cd ~/cvs/tw/bugwarrior
# Active that venv
. venv/bin/activate
# Update from our remote sources
bugwarrior-pull
# Gmail task update time. We're going to:
#
# - Hide and un-hide tasks based upon their snooze/pinned status.
# - Make the 'INBOX' tag match if it's currently in my gmail inbox.
#
# I'm already searching for `label:pinned OR label:snoozed` in my `.bugwarriorrc`, so
# we know everything is already in one of these categories.
#
# - Tasks which correspond to a gmail thread can be found with `gmailurl.any:`
# - `gmaillabels.has:INBOX` is everything that's not snoozed (ie: in my inbox)
# - `gmaillabels.hasnt:INBOX` is thus everything which *is* snoozed.
#
# We want to:
#
# - Find tasks snoozed tasks in gmail that are active in taskwarrior, and snooze (wait) them.
# We need `gmailurl.any` beause otherwise we get non-gmail tasks.
yes | task gmailurl.any: gmaillabels.hasnt:INBOX +PENDING modify -INBOX wait:+7d
# - Find all tasks that are pinned, and un-snooze them.
yes | task gmaillabels.has:INBOX +WAITING modify +INBOX wait:
# The 7-day wait is so my snoozed tasks will reappear at least once a week, but they'll auto-snooze
# the next time I update my tasks. It's to stop me from accidentally snoozing something forever
# and then not touching it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment