Skip to content

Instantly share code, notes, and snippets.

@darkfeline
Last active August 29, 2015 14:00
Show Gist options
  • Save darkfeline/7d138198b68271a9f6fe to your computer and use it in GitHub Desktop.
Save darkfeline/7d138198b68271a9f6fe to your computer and use it in GitHub Desktop.
Script to clean taskwarrior expired task templates
#!/usr/bin/env python
import subprocess
import os
FILE = os.environ['HOME'] + '/.task/pending.data'
x = subprocess.check_output([
'task', 'status:recurring', 'until.before:today', 'ids'])
x = x.decode().rstrip()
lines = x.split(',')
for x in reversed(lines):
if '-' in x:
x = x.split('-')
subprocess.call(['sed', '-i', '{},{}d'.format(x[0], x[1]), FILE])
else:
subprocess.call(['sed', '-i', '{}d'.format(x), FILE])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment