From 08bfbb5ba4be9bf936c86c8cfd38cfe9835a13d4 Mon Sep 17 00:00:00 2001 From: Quey-Liang Kao Date: Sat, 4 Feb 2017 20:58:16 +0800 Subject: Global repo file as the default This patch implments the new workflow mentioned in #31, in which the program still tries to find a repo file in the working directory first, and it tries the global one in the home directory if no one is found. In this patch, the condition check of the existence of the repo file is done in `todolist/file_store.go` at the very early step before the input routing. --- todolist/app.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'todolist/app.go') diff --git a/todolist/app.go b/todolist/app.go index 1ab6b20..e3d8cc7 100644 --- a/todolist/app.go +++ b/todolist/app.go @@ -15,6 +15,11 @@ type App struct { func NewApp() *App { app := &App{TodoList: &TodoList{}, TodoStore: NewFileStore()} + if app.TodoStore.FileLocation == "" { + fmt.Println("No todo file found!") + fmt.Println("You may run 'todo init' to initialize an empty repo in current directory.") + return nil + } return app } -- cgit v1.3