diff options
author | Alen <alen@dotfiles.xyz> | 2023-09-13 01:52:41 +0400 |
---|---|---|
committer | Alen <alen@dotfiles.xyz> | 2023-09-13 02:07:18 +0400 |
commit | d00c86a97392043d66574b8c903f58c04db301ca (patch) | |
tree | 79683f6f2403ef4f6bd7b3bc0a912f494b25e3b2 /dot_local | |
parent | 83228d56450e8d2ae26fa8d1e3e399914fcc4f19 (diff) |
Add todo.txt config
Diffstat (limited to 'dot_local')
-rw-r--r-- | dot_local/bin/executable_todosort.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dot_local/bin/executable_todosort.py b/dot_local/bin/executable_todosort.py new file mode 100644 index 0000000..2f75ee9 --- /dev/null +++ b/dot_local/bin/executable_todosort.py @@ -0,0 +1,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() |