Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
fe3328a1
Commit
fe3328a1
authored
Nov 02, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sort fields for projects and contexts
topydo ls -s project to print all todo items grouped by project.
parent
bd24c1df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
topydo/lib/Sorter.py
topydo/lib/Sorter.py
+4
-0
No files found.
topydo/lib/Sorter.py
View file @
fe3328a1
...
@@ -38,6 +38,8 @@ def get_field_function(p_field):
...
@@ -38,6 +38,8 @@ def get_field_function(p_field):
if
is_priority_field
(
p_field
):
if
is_priority_field
(
p_field
):
# assign dummy priority when a todo has no priority
# assign dummy priority when a todo has no priority
result
=
lambda
a
:
a
.
priority
()
or
'ZZ'
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'
:
elif
p_field
==
'creationdate'
or
p_field
==
'creation'
:
# when a task has no creation date, push it to the end by assigning it
# when a task has no creation date, push it to the end by assigning it
# the maximum possible date.
# the maximum possible date.
...
@@ -50,6 +52,8 @@ def get_field_function(p_field):
...
@@ -50,6 +52,8 @@ def get_field_function(p_field):
result
=
importance
result
=
importance
elif
p_field
==
'importance-avg'
or
p_field
==
'importance-average'
:
elif
p_field
==
'importance-avg'
or
p_field
==
'importance-average'
:
result
=
average_importance
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'
:
elif
p_field
==
'text'
:
result
=
lambda
a
:
a
.
text
()
result
=
lambda
a
:
a
.
text
()
else
:
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment