aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/app.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2016-04-26 09:01:40 -0400
committerGrant Ammons <gammons@gmail.com>2016-04-26 09:01:40 -0400
commite3213b3ef2c84387b66eeb731f5493c5e6da6a5d (patch)
tree46b5ee148e7fd578d992f08ab89ba1d24a322d29 /todolist/app.go
parenta0f7203996439210b2a40663eeeeb8563ab03d68 (diff)
Get adding a todo working
Diffstat (limited to 'todolist/app.go')
-rw-r--r--todolist/app.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/todolist/app.go b/todolist/app.go
index 6122b6a..00effa7 100644
--- a/todolist/app.go
+++ b/todolist/app.go
@@ -1,6 +1,9 @@
package todolist
-import "regexp"
+import (
+ "fmt"
+ "regexp"
+)
type App struct {
TodoStore Store
@@ -12,8 +15,17 @@ func NewApp() *App {
return app
}
-func (a *App) ListTodos(input string) {
+func (a *App) AddTodo(input string) {
+ parser := &Parser{}
+ todo := parser.Parse(input)
+
+ a.TodoStore.Add(todo)
+ a.TodoStore.Save()
+ fmt.Println("Todo added.")
+}
+func (a *App) ListTodos(input string) {
+ //filtered := NewFilter(a.TodoStore.Todos()).filter()
grouped := a.getGroups(input)
formatter := NewFormatter(grouped)