Commit fe3328a1 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add sort fields for projects and contexts

 topydo ls -s project

to print all todo items grouped by project.
parent bd24c1df
......@@ -38,6 +38,8 @@ def get_field_function(p_field):
if is_priority_field(p_field):
# assign dummy priority when a todo has no priority
result = lambda a: a.priority() or 'ZZ'
elif p_field == 'context' or p_field == 'contexts':
result = lambda a: sorted([c.lower() for c in a.contexts()])
elif p_field == 'creationdate' or p_field == 'creation':
# when a task has no creation date, push it to the end by assigning it
# the maximum possible date.
......@@ -50,6 +52,8 @@ def get_field_function(p_field):
result = importance
elif p_field == 'importance-avg' or p_field == 'importance-average':
result = average_importance
elif p_field == 'project' or p_field == 'projects':
result = lambda a: sorted([c.lower() for c in a.projects()])
elif p_field == 'text':
result = lambda a: a.text()
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment