From 5d28dac9b2e1d153f33551b968ab4c92cfce23ce Mon Sep 17 00:00:00 2001 From: Quey-Liang Kao Date: Mon, 14 Aug 2017 14:41:40 +0800 Subject: Implement the "an" feature: Adding notes to todos This patch introduce a new attribute of a todo item, which is "Notes", of type []string. The following enhancing patches will contain the listing, removing and editing features. --- todolist/app.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'todolist/app.go') diff --git a/todolist/app.go b/todolist/app.go index 42b1361..c2bd66a 100644 --- a/todolist/app.go +++ b/todolist/app.go @@ -132,6 +132,21 @@ func (a *App) ExpandTodo(input string) { fmt.Println("Todo expanded.") } +func (a *App) ManipulateNotes(input string) { + a.Load() + id, todo := a.getId(input) + parser := &Parser{} + if id == -1 { + return + } + + retStr := parser.ParseNotes(todo, input) + if retStr != "" { + a.Save() + fmt.Println("Notes " + retStr + "ed.") + } +} + func (a *App) ArchiveCompleted() { a.Load() for _, todo := range a.TodoList.Todos() { -- cgit v1.3