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])
|
subprocess.call(["todo.sh", "add", desc, tag + ":" + date])
|
||||||
|
|
||||||
def due(search_term="", relative=False):
|
def due(search_term="", relative=False):
|
||||||
command = ["todo.sh", "list"]
|
tagList = "\|".join(TAGS)
|
||||||
command.append(search_term)
|
command = ["todo.sh", "list", tagList, search_term]
|
||||||
lines = subprocess.check_output(command).decode(encoding='UTF-8').split('\n')
|
lines = subprocess.check_output(command).decode(encoding='UTF-8').split('\n')
|
||||||
items = []
|
items = [item for item in [todo_item(line) for line in lines] if item.date is not None]
|
||||||
|
|
||||||
for line in lines:
|
|
||||||
if " t:" in line:
|
|
||||||
item = todo_item(line)
|
|
||||||
if item.date is not None:
|
|
||||||
items.append(item)
|
|
||||||
|
|
||||||
items.sort(key= lambda x: x.date)
|
items.sort(key= lambda x: x.date)
|
||||||
|
|
||||||
for i in items:
|
for i in items:
|
||||||
|
Loading…
Reference in New Issue
Block a user