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
ca43307d
Commit
ca43307d
authored
Nov 12, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for OrdinalTagFilter in ListCommand.
parent
a736ccda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
test/ListCommandTest.py
test/ListCommandTest.py
+8
-0
topydo/lib/ListCommand.py
topydo/lib/ListCommand.py
+13
-6
No files found.
test/ListCommandTest.py
View file @
ca43307d
...
@@ -137,6 +137,14 @@ class ListCommandTest(CommandTest.CommandTest):
...
@@ -137,6 +137,14 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
" 1 (C) Foo @Context2 Not@Context +Project1 Not+Project
\
n
4 (C) Drink beer @ home
\
n
5 (C) 13 + 29 = 42
\
n
2 (D) Bar @Context1 +Project2 p:1
\
n
"
)
self
.
assertEquals
(
self
.
output
,
" 1 (C) Foo @Context2 Not@Context +Project1 Not+Project
\
n
4 (C) Drink beer @ home
\
n
5 (C) 13 + 29 = 42
\
n
2 (D) Bar @Context1 +Project2 p:1
\
n
"
)
self
.
assertEquals
(
self
.
errors
,
""
)
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list15
(
self
):
command
=
ListCommand
.
ListCommand
([
"p:<10"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEquals
(
self
.
output
,
" 2 (D) Bar @Context1 +Project2 p:1
\
n
"
)
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_help
(
self
):
def
test_help
(
self
):
command
=
ListCommand
.
ListCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
ListCommand
.
ListCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
...
...
topydo/lib/ListCommand.py
View file @
ca43307d
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
re
import
Command
import
Command
from
Config
import
config
from
Config
import
config
import
Filter
import
Filter
...
@@ -44,21 +46,26 @@ class ListCommand(Command.Command):
...
@@ -44,21 +46,26 @@ class ListCommand(Command.Command):
def
_filters
(
self
):
def
_filters
(
self
):
filters
=
[]
filters
=
[]
def
grep_filters
():
def
arg_filters
():
result
=
[]
for
arg
in
self
.
args
:
for
arg
in
self
.
args
:
if
len
(
arg
)
>
1
and
arg
[
0
]
==
'-'
:
if
re
.
match
(
Filter
.
ORDINAL_TAG_MATCH
,
arg
):
argfilter
=
Filter
.
OrdinalTagFilter
(
arg
)
elif
len
(
arg
)
>
1
and
arg
[
0
]
==
'-'
:
# when a word starts with -, exclude it
# when a word starts with -, exclude it
grep
=
Filter
.
NegationFilter
(
Filter
.
GrepFilter
(
arg
[
1
:]))
argfilter
=
Filter
.
NegationFilter
(
Filter
.
GrepFilter
(
arg
[
1
:]))
else
:
else
:
grep
=
Filter
.
GrepFilter
(
arg
)
argfilter
=
Filter
.
GrepFilter
(
arg
)
result
.
append
(
argfilter
)
filters
.
append
(
grep
)
return
result
if
not
self
.
show_all
:
if
not
self
.
show_all
:
filters
.
append
(
Filter
.
DependencyFilter
(
self
.
todolist
))
filters
.
append
(
Filter
.
DependencyFilter
(
self
.
todolist
))
filters
.
append
(
Filter
.
RelevanceFilter
())
filters
.
append
(
Filter
.
RelevanceFilter
())
grep
_filters
()
filters
+=
arg
_filters
()
if
not
self
.
show_all
:
if
not
self
.
show_all
:
filters
.
append
(
Filter
.
LimitFilter
(
config
().
list_limit
()))
filters
.
append
(
Filter
.
LimitFilter
(
config
().
list_limit
()))
...
...
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