due
due copied to clipboard
Skip completed tasks from listing?
This seems like a good idea to me, but is it? I have applied it on my clone, so I leave a patch here in case anyone wants to try it out. Its trivial though.
diff --git a/due.py b/due.py
index c0fc26a..e04b5c0 100644
--- a/due.py
+++ b/due.py
@@ -52,6 +52,10 @@ def main(todo_file, future_days=0):
key = os.getenv("TODO_TXT_DUE_KEY", "due")
for i, task in enumerate(content):
+
+ # skip completed tasks
+ if task[0] == "x": continue
+
match = re.findall(
r"(\([A-Z]\))?[A-Za-z0-9+@\s]+%s:(\d{4}-\d{2}-\d{2})" % key, task
)
@@ -61,7 +65,7 @@ def main(todo_file, future_days=0):
tasks_with_date.append((i, task, date, match[0][0]))
# Sort tasks that match due: regex by date, then priority
- sorted_tasks = sorted(tasks_with_date, key=lambda tup: (tup[2], tup[3]))
+ sorted_tasks = sorted(tasks_with_date, key=lambda tup: (tup[2], tup[1]))
zero_pad = int(math.log10(len(content))) + 1
# Append to relevant lists for output
Nice idea - perhaps this could be added as an optional flag? I'm not routinely using this format at the moment so not sure if this would be desirable.
Yeah I think an optional flag would be a good idea! I made a proposed solution, please ignore the first commit!
Also, feel free to change the name of the flag, or whatever.