Last active
August 29, 2015 14:00
-
-
Save darkfeline/7d138198b68271a9f6fe to your computer and use it in GitHub Desktop.
Script to clean taskwarrior expired task templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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