diff options
| author | Quey-Liang Kao <nonerkao@gmail.com> | 2017-02-19 22:12:39 +0800 |
|---|---|---|
| committer | Quey-Liang Kao <nonerkao@gmail.com> | 2017-02-19 22:12:39 +0800 |
| commit | 89b73b0df1a5c06cf2399bfb0d46a83e053c6561 (patch) | |
| tree | 2111895b1b169cd7bc68529e32818bab15fca178 /todolist | |
| parent | 08bfbb5ba4be9bf936c86c8cfd38cfe9835a13d4 (diff) | |
Refine previous commit
Diffstat (limited to 'todolist')
| -rw-r--r-- | todolist/app.go | 5 | ||||
| -rw-r--r-- | todolist/file_store.go | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/todolist/app.go b/todolist/app.go index e3d8cc7..1ab6b20 100644 --- a/todolist/app.go +++ b/todolist/app.go @@ -15,11 +15,6 @@ 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 } diff --git a/todolist/file_store.go b/todolist/file_store.go index 63738b2..4a7f0e0 100644 --- a/todolist/file_store.go +++ b/todolist/file_store.go @@ -25,7 +25,10 @@ func NewFileStore() *FileStore { } else if err2 == nil { return &FileStore{FileLocation: homerepo, Loaded: false} } else { - return &FileStore{FileLocation: "", Loaded: false} + fmt.Println("No todo file found!") + fmt.Println("You may run 'todo init' to initialize an empty repo in working directory.") + os.Exit(1) + return nil } } |
