due: Make due() searching more sane
This commit is contained in:
parent
51774b4004
commit
fe50ea8aa2
13
due.py
13
due.py
@ -54,17 +54,10 @@ def add(tag, date_input, desc):
|
||||
subprocess.call(["todo.sh", "add", desc, tag + ":" + date])
|
||||
|
||||
def due(search_term="", relative=False):
|
||||
command = ["todo.sh", "list"]
|
||||
command.append(search_term)
|
||||
tagList = "\|".join(TAGS)
|
||||
command = ["todo.sh", "list", tagList, search_term]
|
||||
lines = subprocess.check_output(command).decode(encoding='UTF-8').split('\n')
|
||||
items = []
|
||||
|
||||
for line in lines:
|
||||
if " t:" in line:
|
||||
item = todo_item(line)
|
||||
if item.date is not None:
|
||||
items.append(item)
|
||||
|
||||
items = [item for item in [todo_item(line) for line in lines] if item.date is not None]
|
||||
items.sort(key= lambda x: x.date)
|
||||
|
||||
for i in items:
|
||||
|
Loading…
Reference in New Issue
Block a user