diff options
| author | Grant Ammons <gammons@gmail.com> | 2016-05-02 07:32:05 -0400 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2016-05-02 07:32:05 -0400 |
| commit | b91b9d073680a0371af825238af230e9618aea12 (patch) | |
| tree | baf9ffba44af3c1b36c76dc9c0cc18e6402c03b1 /todolist/app.go | |
| parent | 34c89ec2ca4b458adb94534c4fae44c921181f59 (diff) | |
Add archive/unarchive
Diffstat (limited to 'todolist/app.go')
| -rw-r--r-- | todolist/app.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/todolist/app.go b/todolist/app.go index 37961e0..598612c 100644 --- a/todolist/app.go +++ b/todolist/app.go @@ -58,6 +58,28 @@ func (a *App) UncompleteTodo(input string) { } } +func (a *App) ArchiveTodo(input string) { + id := a.getId(input) + if id != -1 { + a.TodoStore.Archive(id) + a.TodoStore.Save() + fmt.Println("Todo archived.") + } else { + fmt.Println("Could not find id.") + } +} + +func (a *App) UnarchiveTodo(input string) { + id := a.getId(input) + if id != -1 { + a.TodoStore.Unarchive(id) + a.TodoStore.Save() + fmt.Println("Todo unarchived.") + } else { + fmt.Println("Could not find id.") + } +} + func (a *App) ListTodos(input string) { //filtered := NewFilter(a.TodoStore.Todos()).filter() grouped := a.getGroups(input) |
