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
fddc1544
Commit
fddc1544
authored
Mar 26, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show which todo IDs are incorrect for 'pri'.
parent
43163f4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
topydo/lib/PriorityCommand.py
topydo/lib/PriorityCommand.py
+31
-26
No files found.
topydo/lib/PriorityCommand.py
View file @
fddc1544
...
@@ -31,17 +31,27 @@ class PriorityCommand(Command):
...
@@ -31,17 +31,27 @@ class PriorityCommand(Command):
if
not
super
(
PriorityCommand
,
self
).
execute
():
if
not
super
(
PriorityCommand
,
self
).
execute
():
return
False
return
False
numbers
=
None
priority
=
None
priority
=
None
todos
=
[]
invalid_numbers
=
[]
for
number
in
self
.
args
[:
-
1
]:
try
:
try
:
numbers
=
self
.
args
[:
-
1
]
todos
.
append
(
self
.
todolist
.
todo
(
number
))
priority
=
self
.
args
[
-
1
]
except
InvalidTodoException
:
invalid_numbers
.
append
(
number
)
if
len
(
invalid_numbers
)
>
1
or
len
(
invalid_numbers
)
>
0
and
len
(
todos
)
>
0
:
for
number
in
invalid_numbers
:
self
.
error
(
"Invalid todo number given: {}."
.
format
(
number
))
elif
len
(
invalid_numbers
)
==
1
and
len
(
todos
)
==
0
:
self
.
error
(
"Invalid todo number given."
)
else
:
try
:
priority
=
self
.
args
[
-
1
]
self
.
printer
.
add_filter
(
PrettyPrinterNumbers
(
self
.
todolist
))
self
.
printer
.
add_filter
(
PrettyPrinterNumbers
(
self
.
todolist
))
if
len
(
numbers
)
>
0
:
if
len
(
todos
)
>
0
:
todos
=
[
self
.
todolist
.
todo
(
number
)
for
number
in
numbers
]
if
is_valid_priority
(
priority
):
if
is_valid_priority
(
priority
):
for
todo
in
todos
:
for
todo
in
todos
:
old_priority
=
todo
.
priority
()
old_priority
=
todo
.
priority
()
...
@@ -60,11 +70,6 @@ class PriorityCommand(Command):
...
@@ -60,11 +70,6 @@ class PriorityCommand(Command):
self
.
error
(
self
.
usage
())
self
.
error
(
self
.
usage
())
except
(
IndexError
,
InvalidCommandArgument
):
except
(
IndexError
,
InvalidCommandArgument
):
self
.
error
(
self
.
usage
())
self
.
error
(
self
.
usage
())
except
(
InvalidTodoException
):
if
len
(
numbers
)
>
0
and
priority
:
self
.
error
(
"Invalid todo number given."
)
else
:
self
.
error
(
self
.
usage
())
def
usage
(
self
):
def
usage
(
self
):
return
"""Synopsis: pri <NUMBER1> [<NUMBER2> ...] <PRIORITY>"""
return
"""Synopsis: pri <NUMBER1> [<NUMBER2> ...] <PRIORITY>"""
...
...
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