aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/app.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2016-05-02 06:34:38 -0400
committerGrant Ammons <gammons@gmail.com>2016-05-02 06:34:38 -0400
commit54e9313ad14269f57a13b32aac59aea17f86d151 (patch)
tree9c6364af5e93d6b80df893d317894f60d6662940 /todolist/app.go
parentb1fc3359eb7498236621d1aa6a9ff18f8cce73c0 (diff)
Get completing todos to work correctly
Diffstat (limited to 'todolist/app.go')
-rw-r--r--todolist/app.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/todolist/app.go b/todolist/app.go
index 267f482..fec64d2 100644
--- a/todolist/app.go
+++ b/todolist/app.go
@@ -36,6 +36,17 @@ func (a *App) DeleteTodo(input string) {
}
}
+func (a *App) CompleteTodo(input string) {
+ id := a.getId(input)
+ if id != -1 {
+ a.TodoStore.Complete(id)
+ a.TodoStore.Save()
+ fmt.Println("Todo completed.")
+ } else {
+ fmt.Println("Could not find id.")
+ }
+}
+
func (a *App) ListTodos(input string) {
//filtered := NewFilter(a.TodoStore.Todos()).filter()
grouped := a.getGroups(input)