aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/app.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2017-05-25 09:56:02 -0400
committerGitHub <noreply@github.com>2017-05-25 09:56:02 -0400
commite015094d20811d30676014d60d8219fa0fa63e8a (patch)
tree5ba56e64e881cd0e0cdff4037033e5003d570c8c /todolist/app.go
parent6cb4a95af8bc4a8348c7b115fba334e668fe95e5 (diff)
parentf70fd56e6f2144f19150fb0fca2508a5897ab48b (diff)
Merge pull request #62 from gammons/unified-edit
Unified edit
Diffstat (limited to 'todolist/app.go')
-rw-r--r--todolist/app.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/todolist/app.go b/todolist/app.go
index 880390e..56787d3 100644
--- a/todolist/app.go
+++ b/todolist/app.go
@@ -5,7 +5,6 @@ import (
"regexp"
"strconv"
"strings"
- "time"
)
type App struct {
@@ -92,16 +91,18 @@ func (a *App) UnarchiveTodo(input string) {
fmt.Println("Todo unarchived.")
}
-func (a *App) EditTodoDue(input string) {
+func (a *App) EditTodo(input string) {
a.Load()
id, todo := a.getId(input)
if id == -1 {
return
}
parser := &Parser{}
- todo.Due = parser.Due(input, time.Now())
- a.Save()
- fmt.Println("Todo due date updated.")
+
+ if parser.ParseEditTodo(todo, input) {
+ a.Save()
+ fmt.Println("Todo updated.")
+ }
}
func (a *App) ExpandTodo(input string) {
@@ -181,11 +182,14 @@ func (a *App) getId(input string) (int, *Todo) {
if todo == nil {
fmt.Println("No such id.")
return -1, nil
+
}
return id, todo
+
} else {
fmt.Println("Invalid id.")
return -1, nil
+
}
}