kevinschoon-pomo/types.go

45 lines
741 B
Go
Raw Normal View History

2018-01-16 10:50:08 +01:00
package main
import (
"fmt"
"os/exec"
"time"
)
// Task describes some activity
type Task struct {
2018-01-16 13:02:35 +01:00
ID int `json:"id"`
2018-01-17 06:14:20 +01:00
Message string `json:"message"`
2018-01-16 13:02:35 +01:00
Records []*Record `json:"records"`
2018-01-16 10:50:08 +01:00
count int
duration time.Duration
}
2018-01-16 12:06:20 +01:00
// Record is a stetch of work performed on a
2018-01-16 10:50:08 +01:00
// specific task.
2018-01-16 12:06:20 +01:00
type Record struct {
2018-01-16 13:02:35 +01:00
Start time.Time `json:"start"`
End time.Time `json:"end"`
2018-01-16 10:50:08 +01:00
}
// Prompter prompts a user with a message.
type Prompter interface {
Prompt(string) error
}
// I3 implements a prompter for i3
type I3 struct{}
func (i *I3) Prompt(message string) error {
raw, err := exec.Command(
"/bin/i3-nagbar",
"-m",
message,
).Output()
if err != nil {
return err
}
fmt.Println(string(raw))
return nil
}