diff options
| author | Quey-Liang Kao <s101062801@m101.nthu.edu.tw> | 2017-02-04 20:58:16 +0800 |
|---|---|---|
| committer | Quey-Liang Kao <s101062801@m101.nthu.edu.tw> | 2017-02-04 20:58:16 +0800 |
| commit | 08bfbb5ba4be9bf936c86c8cfd38cfe9835a13d4 (patch) | |
| tree | ffe6a7eb015bd48b58a64659cd12a6003115ea33 /todolist/app.go | |
| parent | be32789ec53ebe0a2141cf4d13696280ef79ee7f (diff) | |
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.
Diffstat (limited to 'todolist/app.go')
| -rw-r--r-- | todolist/app.go | 5 |
1 files changed, 5 insertions, 0 deletions
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 } |
