diff --git a/cmd/add.go b/cmd/add.go index 8a4f69f0..64879fba 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -48,7 +48,7 @@ var addNoteCmd = &cobra.Command{ Long: addNoteCmdLongDesc, Short: addNoteCmdDesc, Run: func(cmd *cobra.Command, args []string) { - ultralist.NewApp().HandleNotes("an " + strings.Join(args, " ")) + ultralist.NewApp().HandleNotes(strings.Join(args, " ")) }, } diff --git a/ultralist/app.go b/ultralist/app.go index bffe445e..dc73cb51 100644 --- a/ultralist/app.go +++ b/ultralist/app.go @@ -186,14 +186,14 @@ func (a *App) HandleNotes(input string) { return } parser := &NoteParser{} - - if parser.ParseAddNote(todo, input) { + regexedInput := "an " + input + if parser.ParseAddNote(todo, regexedInput) { fmt.Println("Note added.") - } else if parser.ParseDeleteNote(todo, input) { + } else if parser.ParseDeleteNote(todo, regexedInput) { fmt.Println("Note deleted.") - } else if parser.ParseEditNote(todo, input) { + } else if parser.ParseEditNote(todo, regexedInput) { fmt.Println("Note edited.") - } else if parser.ParseShowNote(todo, input) { + } else if parser.ParseShowNote(todo, regexedInput) { groups := map[string][]*Todo{} groups[""] = append(groups[""], todo) a.Printer.Print(&GroupedTodos{Groups: groups}, true, true)