default filter
This commit is contained in:
parent
6025116196
commit
b6fffe1f26
@ -36,7 +36,6 @@ def get_files(dirname):
|
|||||||
dirname = "."
|
dirname = "."
|
||||||
else:
|
else:
|
||||||
dirname = dirname
|
dirname = dirname
|
||||||
print(dirname)
|
|
||||||
p = pathlib.Path(dirname).expanduser()
|
p = pathlib.Path(dirname).expanduser()
|
||||||
return p.rglob("*.md")
|
return p.rglob("*.md")
|
||||||
|
|
||||||
@ -142,10 +141,13 @@ def parse_todo_tag(tag, val) -> tuple[str, str]:
|
|||||||
return tag, style_override
|
return tag, style_override
|
||||||
"""
|
"""
|
||||||
if tag == "by":
|
if tag == "by":
|
||||||
dval = parser.parse(val)
|
try:
|
||||||
days_left = dval - now
|
dval = parser.parse(val)
|
||||||
style = "red" if days_left.days <= 0 else "yellow"
|
days_left = dval - now
|
||||||
return f"by {dval.date()} ({days_left.days})", style
|
style = "red" if days_left.days <= 0 else "yellow"
|
||||||
|
return f"by {dval.date()} ({days_left.days})", style
|
||||||
|
except parser.ParserError:
|
||||||
|
return f"by: {val}", "#cccccc"
|
||||||
else:
|
else:
|
||||||
return f"{tag}:{val}", ""
|
return f"{tag}:{val}", ""
|
||||||
|
|
||||||
@ -231,6 +233,8 @@ def todos(dirname, sort, filter):
|
|||||||
output += pull_todos(file)
|
output += pull_todos(file)
|
||||||
|
|
||||||
# filter
|
# filter
|
||||||
|
if not filter:
|
||||||
|
filter = ["status:TODO"]
|
||||||
for rule in filter:
|
for rule in filter:
|
||||||
output = apply_filter(output, rule)
|
output = apply_filter(output, rule)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user