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
cd587fd6
Commit
cd587fd6
authored
Feb 07, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow 'pri' to prioritize multiple todos at once.
Fixes issue #5
parent
2a9be13f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
topydo/lib/PriorityCommand.py
topydo/lib/PriorityCommand.py
+24
-15
No files found.
topydo/lib/PriorityCommand.py
View file @
cd587fd6
...
...
@@ -30,30 +30,39 @@ class PriorityCommand(Command):
if
not
super
(
PriorityCommand
,
self
).
execute
():
return
False
number
=
None
number
s
=
None
priority
=
None
try
:
number
=
self
.
argument
(
0
)
priority
=
self
.
argument
(
1
)
todo
=
self
.
todolist
.
todo
(
number
)
numbers
=
self
.
args
[:
-
1
]
priority
=
self
.
args
[
-
1
]
if
is_valid_priority
(
priority
):
old_priority
=
todo
.
priority
()
self
.
todolist
.
set_priority
(
todo
,
priority
)
if
len
(
numbers
)
>
0
:
todos
=
[]
for
number
in
numbers
:
todos
.
append
(
self
.
todolist
.
todo
(
number
))
if
old_priority
and
priority
and
old_priority
!=
priority
:
self
.
out
(
"Priority changed from {} to {}"
.
format
(
old_priority
,
priority
))
elif
not
old_priority
:
self
.
out
(
"Priority set to {}."
.
format
(
priority
))
if
is_valid_priority
(
priority
):
for
todo
in
todos
:
old_priority
=
todo
.
priority
()
self
.
todolist
.
set_priority
(
todo
,
priority
)
self
.
out
(
self
.
printer
.
print_todo
(
todo
))
if
old_priority
and
priority
and
old_priority
!=
priority
:
self
.
out
(
"Priority changed from {} to {}"
.
format
(
old_priority
,
priority
))
elif
not
old_priority
:
self
.
out
(
"Priority set to {}."
.
format
(
priority
))
self
.
out
(
self
.
printer
.
print_todo
(
todo
))
else
:
self
.
error
(
"Invalid priority given."
)
else
:
self
.
error
(
"Invalid priority given."
)
self
.
error
(
self
.
usage
())
except
IndexError
:
self
.
error
(
self
.
usage
())
except
InvalidCommandArgument
:
self
.
error
(
self
.
usage
())
except
(
InvalidTodoException
):
if
number
and
priority
:
if
len
(
numbers
)
>
0
and
priority
:
self
.
error
(
"Invalid todo number given."
)
else
:
self
.
error
(
self
.
usage
())
...
...
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