blob: 2f75ee98fb6de075755def1aced37ec5fdee5fe6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env python3
import sys
def main() -> None:
priority_words = {w.lower() for w in sys.argv[1:]}
lines = []
for line in sys.stdin.readlines():
words = line.split()
if words[1].startswith('(') and words[1].endswith(')'):
priority = words[1]
else:
priority = '(X)'
for due in words:
if due.startswith('due:'):
break
else:
due = 'due:3000-01-01'
has_priority_words = not any(w.lstrip('+#@').lower() in priority_words for w in words)
lines.append((priority, has_priority_words, due, line))
print(''.join(l for *_, l in sorted(lines)))
if __name__ == '__main__':
main()
|