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
b770db60
Commit
b770db60
authored
May 05, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `depri` on multiple todo items at once
parent
2295ff51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
topydo/lib/DepriCommand.py
topydo/lib/DepriCommand.py
+15
-20
No files found.
topydo/lib/DepriCommand.py
View file @
b770db60
...
...
@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
topydo.lib.
Command
import
Command
,
InvalidCommandArgument
from
topydo.lib.
TodoListBase
import
InvalidTodoException
from
topydo.lib.
MultiCommand
import
MultiCommand
from
topydo.lib.
PrettyPrinterFilter
import
PrettyPrinterNumbers
class
DepriCommand
(
Command
):
class
DepriCommand
(
Multi
Command
):
def
__init__
(
self
,
p_args
,
p_todolist
,
p_out
=
lambda
a
:
None
,
p_err
=
lambda
a
:
None
,
...
...
@@ -25,28 +25,23 @@ class DepriCommand(Command):
super
(
DepriCommand
,
self
).
__init__
(
p_args
,
p_todolist
,
p_out
,
p_err
,
p_prompt
)
def
execute
(
self
):
if
not
super
(
DepriCommand
,
self
).
execute
():
return
False
self
.
get_todos
(
self
.
args
)
todo
=
None
def
execute_multi_specific
(
self
):
try
:
todo
=
self
.
todolist
.
todo
(
self
.
argument
(
0
))
self
.
printer
.
add_filter
(
PrettyPrinterNumbers
(
self
.
todolist
))
if
todo
.
priority
()
!=
None
:
self
.
todolist
.
set_priority
(
todo
,
None
)
self
.
out
(
"Priority removed."
)
self
.
out
(
self
.
printer
.
print_todo
(
todo
))
except
InvalidCommandArgument
:
for
todo
in
self
.
todos
:
if
todo
.
priority
()
!=
None
:
self
.
todolist
.
set_priority
(
todo
,
None
)
self
.
out
(
"Priority removed."
)
self
.
out
(
self
.
printer
.
print_todo
(
todo
))
except
IndexError
:
self
.
error
(
self
.
usage
())
except
(
InvalidTodoException
):
if
not
todo
:
self
.
error
(
"Invalid todo number given."
)
else
:
self
.
error
(
self
.
usage
())
def
usage
(
self
):
return
"""Synopsis: depri <NUMBER
>
"""
return
"""Synopsis: depri <NUMBER
1> [<NUMBER2> ...]
"""
def
help
(
self
):
return
"""Removes the priority of the given todo item."""
return
"""Removes the priority of the given todo item
(s)
."""
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