diff --git a/main.go b/main.go index dfa38b0..137701d 100644 --- a/main.go +++ b/main.go @@ -37,11 +37,11 @@ func startTask(task Task, prompter Prompter, db *Store) { } func start(cmd *cli.Cmd) { - cmd.Spec = "[OPTIONS] NAME" + cmd.Spec = "[OPTIONS] MESSAGE" var ( duration = cmd.StringOpt("d duration", "25m", "duration of each stent") count = cmd.IntOpt("c count", 4, "number of working stents") - name = cmd.StringArg("NAME", "", "descriptive name of the given task") + message = cmd.StringArg("MESSAGE", "", "descriptive name of the given task") path = cmd.StringOpt("p path", defaultDBPath(), "path to the pomo state directory") ) cmd.Action = func() { @@ -51,7 +51,7 @@ func start(cmd *cli.Cmd) { maybe(err) defer db.Close() task := Task{ - Name: *name, + Message: *message, count: *count, duration: parsed, } diff --git a/store.go b/store.go index e24c4bb..9aa63e1 100644 --- a/store.go +++ b/store.go @@ -36,7 +36,7 @@ func (s Store) CreateTask(task Task) (int, error) { if err != nil { return -1, err } - _, err = tx.Exec("INSERT INTO task (name) VALUES ($1)", task.Name) + _, err = tx.Exec("INSERT INTO task (message) VALUES ($1)", task.Message) if err != nil { tx.Rollback() return -1, err @@ -60,14 +60,14 @@ func (s Store) CreateRecord(taskID int, record Record) error { } func (s Store) ReadTasks() ([]*Task, error) { - rows, err := s.db.Query(`SELECT rowid,name FROM task`) + rows, err := s.db.Query(`SELECT rowid,message FROM task`) if err != nil { return nil, err } tasks := []*Task{} for rows.Next() { task := &Task{Records: []*Record{}} - err = rows.Scan(&task.ID, &task.Name) + err = rows.Scan(&task.ID, &task.Message) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func (s Store) Close() error { return s.db.Close() } func initDB(db *Store) error { stmt := ` CREATE TABLE task ( - name TEXT + message TEXT ); CREATE TABLE record ( task_id INTEGER, diff --git a/types.go b/types.go index b1eaa54..45ed4f9 100644 --- a/types.go +++ b/types.go @@ -9,7 +9,7 @@ import ( // Task describes some activity type Task struct { ID int `json:"id"` - Name string `json:"name"` + Message string `json:"message"` Records []*Record `json:"records"` count int duration time.Duration