From 86be4b4dec5c920f227ef487a19b3472981ffcac Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Wed, 4 May 2016 14:09:02 -0400 Subject: Add edit command for due dates --- todolist/app.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'todolist') diff --git a/todolist/app.go b/todolist/app.go index be40eb3..0d3ce95 100644 --- a/todolist/app.go +++ b/todolist/app.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strconv" + "time" ) type App struct { @@ -80,6 +81,19 @@ func (a *App) UnarchiveTodo(input string) { } } +func (a *App) EditTodoDue(input string) { + id := a.getId(input) + if id != -1 { + todo := a.TodoStore.FindById(id) + parser := &Parser{} + todo.Due = parser.Due(input, time.Now()) + a.TodoStore.Save() + fmt.Println("Todo due date updated.") + } else { + fmt.Println("Could not find id.") + } +} + func (a *App) ArchiveCompleted() { for _, todo := range a.TodoStore.Todos() { if todo.Completed { -- cgit v1.3