diff options
| author | Quey-Liang Kao <s101062801@m101.nthu.edu.tw> | 2017-09-21 12:16:10 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-21 12:16:10 -0500 |
| commit | 902d0f825abc3a18278aadc2a8c3cd45dd8d308d (patch) | |
| tree | c08037986e9981ebd8e56fe8dd851fa99fcd4c32 /todolist/formatter.go | |
| parent | 06211d84da190ab9a5e174db9f52672b69f9b3e4 (diff) | |
| parent | a716a04c831e4fb23cdd558756d8f393e4ef8d73 (diff) | |
Merge pull request #89 from NonerKao/note
Add new feature: notes for todos
Diffstat (limited to 'todolist/formatter.go')
| -rw-r--r-- | todolist/formatter.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/todolist/formatter.go b/todolist/formatter.go index c0f3313..e7863db 100644 --- a/todolist/formatter.go +++ b/todolist/formatter.go @@ -25,7 +25,7 @@ func NewFormatter(todos *GroupedTodos) *Formatter { return formatter } -func (f *Formatter) Print() { +func (f *Formatter) Print(printNotes bool) { cyan := color.New(color.FgCyan).SprintFunc() var keys []string @@ -38,6 +38,12 @@ func (f *Formatter) Print() { fmt.Fprintf(f.Writer, "\n %s\n", cyan(key)) for _, todo := range f.GroupedTodos.Groups[key] { f.printTodo(todo) + if printNotes { + for nid, note := range todo.Notes { + fmt.Fprintf(f.Writer, " %s\t%s\t\n", + cyan(strconv.Itoa(nid)), note) + } + } } } f.Writer.Flush() |
