Commit 42dba297 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add append command.

parent a2627d36
import Command
from Utils import convert_todo_number
class AppendCommand(Command.Command):
def __init__(self, p_args, p_todolist):
super(AppendCommand, self).__init__(p_args, p_todolist)
def execute(self):
number = convert_todo_number(self.argument(0))
text = self.argument(1)
self.todolist.append(number, text)
return True
...@@ -5,6 +5,7 @@ import re ...@@ -5,6 +5,7 @@ import re
import sys import sys
from AddCommand import AddCommand from AddCommand import AddCommand
from AppendCommand import AppendCommand
from DepCommand import DepCommand from DepCommand import DepCommand
import Config import Config
import Filter import Filter
...@@ -69,12 +70,8 @@ class Application(object): # TODO: rename to CLIApplication ...@@ -69,12 +70,8 @@ class Application(object): # TODO: rename to CLIApplication
def append(self): def append(self):
""" Appends a text to a todo item. """ """ Appends a text to a todo item. """
number = convert_todo_number(argument(2)) command = AppendCommand(arguments(), self.todolist)
text = argument(3) command.execute()
self.todolist.append(number, text)
self.print_todo(number)
def dep(self): def dep(self):
command = DepCommand(arguments(), self.todolist) command = DepCommand(arguments(), self.todolist)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment