24 Commits

Author SHA1 Message Date
bel
87c937b6f1 oop 2023-10-15 10:40:13 -06:00
bel
ed474b8c3a default file path if not empty 2023-10-15 10:39:58 -06:00
bel
46e62dc485 fix nil ptr on no previous file 2023-10-15 10:39:01 -06:00
Bel LaPointe
236355b69d skip hidden files 2023-08-16 06:54:21 -06:00
Bel LaPointe
6bb6c847aa nil ptr 2023-07-16 19:47:11 -06:00
Bel LaPointe
6bad1e1365 on write conflict during vim, save as filename.uuid..fileExtension 2023-07-02 10:22:04 -06:00
Bel LaPointe
d105df15e9 support -add-tags x,y,z 2023-04-24 15:02:13 -06:00
Bel LaPointe
afc7d6001a fix 2023-04-10 10:45:16 -06:00
Bel LaPointe
242f9ee1b4 gr 2023-04-10 10:44:41 -06:00
Bel LaPointe
5a30481ff1 partial go mod 2023-04-10 10:42:11 -06:00
Bel LaPointe
438c0ade59 gitignore 2022-09-10 11:25:23 -06:00
Bel LaPointe
e5b3fd3195 no prior file exists ok 2022-09-10 11:24:41 -06:00
Bel LaPointe
49893c7ffe on scheduled task done, in addition to requeue, add to done 2022-09-10 11:13:18 -06:00
Bel LaPointe
39d222b133 quick add via cli -add, -add-schedule 2022-04-07 12:48:17 -06:00
Bel LaPointe
461e88ee17 root moves fixed future schedules to shceduled on automove 2022-03-24 14:43:45 -06:00
Bel LaPointe
916ad212f4 revert to clean todo 2022-03-24 09:26:44 -06:00
Bel LaPointe
bd5028ff8d revert automove for crons 2022-03-24 09:25:34 -06:00
Bel LaPointe
21ccb7ff4c always write ts, when a todo with schedule deleted, conditionally go back to schedule for loopers 2022-03-24 09:18:19 -06:00
Bel LaPointe
1b1ed01937 cli on delete todo, write in Done identified by entire struct so dupes wouldnt but thats ok 2022-03-23 09:46:16 -06:00
Bel LaPointe
5a1936721d add todo.ID() 2022-03-23 09:42:21 -06:00
Bel LaPointe
77fb27dc09 ready for find deleted 2022-03-23 08:06:57 -06:00
Bel LaPointe
2eda765ad9 if item in todo is scheduled for later, then move it 2022-03-23 08:04:35 -06:00
Bel LaPointe
a8fbc13e7c new edit ready for shuffles 2022-03-23 07:49:54 -06:00
Bel LaPointe
d8e732087a getconfig in pttodo-cli 2022-03-23 07:27:49 -06:00
10 changed files with 210 additions and 106 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ todo-server-yaml
cmd/cmd cmd/cmd
cmd/cli cmd/cli
cmd/pttodo/pttodo cmd/pttodo/pttodo
cmd/pttodo-cli/pttodo-cli

View File

@@ -6,7 +6,6 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"local/pt-todo-server/pttodo"
"log" "log"
"os" "os"
"os/exec" "os/exec"
@@ -16,6 +15,10 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/google/uuid"
"gogs.inhome.blapointe.com/bel/pttodo/pttodo"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
@@ -34,6 +37,9 @@ type config struct {
search string search string
edit bool edit bool
dry bool dry bool
add string
addSchedule string
addTags string
} }
func main() { func main() {
@@ -49,6 +55,16 @@ func _main() error {
return err return err
} }
} }
if config.add != "" {
v := pttodo.Todo{
Todo: config.add,
Schedule: pttodo.Schedule(config.addSchedule),
Tags: config.addTags,
}
if err := add(config.dry, config.targets, v); err != nil {
return err
}
}
if config.edit { if config.edit {
if err := edit(config.dry, config.targets); err != nil { if err := edit(config.dry, config.targets); err != nil {
return err return err
@@ -58,8 +74,8 @@ func _main() error {
} }
func getConfig() config { func getConfig() config {
defaultFilepath, ok := os.LookupEnv("PTTODO_FILE") defaultFilepath := os.Getenv("PTTODO_FILE")
if !ok { if defaultFilepath == "" {
defaultFilepath = "./todo.yaml" defaultFilepath = "./todo.yaml"
} }
@@ -69,10 +85,13 @@ func getConfig() config {
flag.StringVar(&config.mergeme, "g", "", "path to yaml file to merge into -f (modifies f)") flag.StringVar(&config.mergeme, "g", "", "path to yaml file to merge into -f (modifies f)")
flag.StringVar(&config.root, "root", DUMP_TODO, "path to pretty print ("+fmt.Sprint([]string{DUMP_ALL, DUMP_TODO, DUMP_SCHEDULED, DUMP_DONE})+")") flag.StringVar(&config.root, "root", DUMP_TODO, "path to pretty print ("+fmt.Sprint([]string{DUMP_ALL, DUMP_TODO, DUMP_SCHEDULED, DUMP_DONE})+")")
var tagss string var tagss string
flag.StringVar(&tagss, "tags", "", "csv of all tags to find, -tag to invert") flag.StringVar(&tagss, "tags", "", "csv of all tags to find, -x to invert")
flag.StringVar(&config.search, "search", "", "fts case insensitive") flag.StringVar(&config.search, "search", "", "fts case insensitive")
flag.BoolVar(&config.edit, "e", false, "edit file") flag.BoolVar(&config.edit, "e", false, "edit file")
flag.BoolVar(&config.dry, "dry", false, "dry run") flag.BoolVar(&config.dry, "dry", false, "dry run")
flag.StringVar(&config.add, "add", "", "todo to add")
flag.StringVar(&config.addSchedule, "add-schedule", "", "todo to add schedule")
flag.StringVar(&config.addTags, "add-tags", "", "todo to add csv tags")
flag.Parse() flag.Parse()
config.tags = strings.Split(tagss, ",") config.tags = strings.Split(tagss, ",")
@@ -109,17 +128,46 @@ func verifyFile(path string) error {
return nil return nil
} }
func add(dry bool, filepaths []string, todo pttodo.Todo) error {
target := filepaths[0]
var original pttodo.Root
r, err := filePathReader(target)
if err != nil {
return err
}
if err := yaml.NewDecoder(r).Decode(&original); err != nil {
return err
}
original.Todo = append([]pttodo.Todo{todo}, original.Todo...)
original.AutoMove()
c, err := yaml.Marshal(original)
if err != nil {
return err
} else if dry {
log.Printf("wouldve written...\n%s", c)
return nil
} else if err := ioutil.WriteFile(target, c, os.ModePerm); err != nil {
return err
}
return nil
}
func edit(dry bool, filepaths []string) error { func edit(dry bool, filepaths []string) error {
tempDir, err := ioutil.TempDir(os.TempDir(), "edit-pttodo-*") tempDir, err := ioutil.TempDir(os.TempDir(), "edit-pttodo-*")
if err != nil { if err != nil {
return err return err
} }
originals := map[string]pttodo.Root{} originals := map[string]pttodo.Root{}
lastModified := map[string]time.Time{}
for _, target := range filepaths { for _, target := range filepaths {
var original pttodo.Root var original pttodo.Root
if b, err := ioutil.ReadFile(target); err != nil && !os.IsNotExist(err) { if r, err := filePathReader(target); err != nil {
return err return err
} else if err := yaml.Unmarshal(b, &original); err != nil { } else if err := yaml.NewDecoder(r).Decode(&original); err != nil {
return err return err
} else if c, err := yaml.Marshal(original.Todo); err != nil { } else if c, err := yaml.Marshal(original.Todo); err != nil {
return err return err
@@ -127,6 +175,11 @@ func edit(dry bool, filepaths []string) error {
return err return err
} }
originals[target] = original originals[target] = original
if info, _ := os.Stat(target); info != nil {
lastModified[target] = info.ModTime()
} else {
lastModified[target] = time.Time{}
}
} }
if err := vimd(tempDir); err != nil { if err := vimd(tempDir); err != nil {
return err return err
@@ -135,9 +188,9 @@ func edit(dry bool, filepaths []string) error {
for { for {
err := func() error { err := func() error {
var todos []pttodo.Todo var todos []pttodo.Todo
if b, err := ioutil.ReadFile(path.Join(tempDir, path.Base(target))); err != nil { if r, err := filePathReader(path.Join(tempDir, path.Base(target))); err != nil {
return err return err
} else if err := yaml.Unmarshal(b, &todos); err != nil { } else if err := yaml.NewDecoder(r).Decode(&todos); err != nil {
return err return err
} }
return nil return nil
@@ -159,12 +212,12 @@ func edit(dry bool, filepaths []string) error {
return nil return nil
} }
for _, target := range filepaths { for _, target := range filepaths {
b, err := ioutil.ReadFile(path.Join(tempDir, path.Base(target))) r, err := filePathReader(path.Join(tempDir, path.Base(target)))
if err != nil { if err != nil {
return err return err
} }
var newTodos []pttodo.Todo var newTodos []pttodo.Todo
if err := yaml.Unmarshal(b, &newTodos); err != nil { if err := yaml.NewDecoder(r).Decode(&newTodos); err != nil {
return err return err
} }
original := originals[target] original := originals[target]
@@ -179,9 +232,8 @@ func edit(dry bool, filepaths []string) error {
original.Todo[i].TS = pttodo.TS(time.Now().Unix()) original.Todo[i].TS = pttodo.TS(time.Now().Unix())
if string(original.Todo[i].Schedule) != "" && !original.Todo[i].Triggered() { if string(original.Todo[i].Schedule) != "" && !original.Todo[i].Triggered() {
original.Scheduled = append(original.Scheduled, original.Todo[i]) original.Scheduled = append(original.Scheduled, original.Todo[i])
} else {
original.Done = append(original.Done, original.Todo[i])
} }
original.Done = append(original.Done, original.Todo[i])
} }
} }
original.Todo = newTodos original.Todo = newTodos
@@ -192,7 +244,11 @@ func edit(dry bool, filepaths []string) error {
if err != nil { if err != nil {
return err return err
} }
if err := ioutil.WriteFile(target, c, os.ModePerm); err != nil { outputPath := target
if info, _ := os.Stat(target); info != nil && info.ModTime() != lastModified[target] {
outputPath = fmt.Sprintf("%s.%s.%s", outputPath, uuid.New().String(), path.Ext(outputPath))
}
if err := ioutil.WriteFile(outputPath, c, os.ModePerm); err != nil {
return err return err
} }
} }
@@ -262,13 +318,13 @@ func _edit(dry bool, filepaths []string) error {
saveOne := func(filepath string) error { saveOne := func(filepath string) error {
tempFile := path.Join(tempDir, path.Base(filepath)) tempFile := path.Join(tempDir, path.Base(filepath))
var rootTemp, rootOld pttodo.Root var rootTemp, rootOld pttodo.Root
if a, err := ioutil.ReadFile(tempFile); err != nil { if a, err := filePathReader(tempFile); err != nil {
return err return err
} else if err := yaml.Unmarshal(a, &rootTemp); err != nil { } else if err := yaml.NewDecoder(a).Decode(&rootTemp); err != nil {
return err return err
} else if b, err := ioutil.ReadFile(filepath); err != nil { } else if b, err := filePathReader(filepath); err != nil {
return err return err
} else if err := yaml.Unmarshal(b, &rootOld); err != nil { } else if err := yaml.NewDecoder(b).Decode(&rootOld); err != nil {
return err return err
} else if rootTemp.Equals(rootOld) { } else if rootTemp.Equals(rootOld) {
//log.Printf("no changes to %s", filepath) //log.Printf("no changes to %s", filepath)
@@ -494,17 +550,17 @@ func dump(dry bool, writer io.Writer, filepaths []string, tags []string, search,
} }
func filePathReader(path string) (io.Reader, error) { func filePathReader(path string) (io.Reader, error) {
var reader io.Reader
if path == "-" { if path == "-" {
reader = os.Stdin return os.Stdin, nil
} else { }
b, err := ioutil.ReadFile(path) b, err := ioutil.ReadFile(path)
if os.IsNotExist(err) {
return bytes.NewReader([]byte("{}")), nil
}
if err != nil { if err != nil {
return nil, err return nil, err
} }
reader = bytes.NewReader(b) return bytes.NewReader(b), nil
}
return reader, nil
} }
func listDir(dname string) ([]string, error) { func listDir(dname string) ([]string, error) {
@@ -517,6 +573,9 @@ func listDir(dname string) ([]string, error) {
if entries[i].IsDir() { if entries[i].IsDir() {
continue continue
} }
if strings.HasPrefix(path.Base(entries[i].Name()), ".") {
continue
}
paths = append(paths, path.Join(dname, entries[i].Name())) paths = append(paths, path.Join(dname, entries[i].Name()))
} }
sort.Slice(paths, func(i, j int) bool { sort.Slice(paths, func(i, j int) bool {

View File

@@ -3,10 +3,13 @@ module pttodo-cli
go 1.17 go 1.17
require ( require (
gogs.inhome.blapointe.com/bel/pttodo v0.4.0
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
local/pt-todo-server v0.0.0-00010101000000-000000000000
) )
require github.com/robfig/cron/v3 v3.0.1 // indirect require (
github.com/google/uuid v1.3.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
)
replace local/pt-todo-server => ../../ replace gogs.inhome.blapointe.com/bel/pttodo => ../..

View File

@@ -1,3 +1,5 @@
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

View File

@@ -1,45 +1,10 @@
todo: todo:
- todo: b - hi20890
ts: Thu Mar 24 09:03:24 MDT 2022 - hi
scheduled: - b
- todo: due
schedule: "2022-05-01"
ts: Thu Mar 24 09:16:21 MDT 2022
- todo: loop - todo: loop
schedule: 10s schedule: 10s
ts: Thu Mar 24 09:17:11 MDT 2022 - todo: past
done: schedule: "2000-01-02"
- todo: abc scheduled: []
schedule: "2022-05-01" done: []
ts: Wed Mar 23 08:03:45 MDT 2022
- todo: def
schedule: "2022-05-01"
ts: Wed Mar 23 08:04:05 MDT 2022
- todo: other
ts: Wed Mar 23 09:44:57 MDT 2022
- todo: b
ts: Wed Mar 23 09:45:13 MDT 2022
- todo: a
ts: Wed Mar 23 09:45:15 MDT 2022
- todo: a
ts: Wed Mar 23 09:45:24 MDT 2022
- todo: a
ts: Wed Mar 23 09:45:31 MDT 2022
- todo: looper
schedule: 15s
ts: Thu Mar 24 09:01:41 MDT 2022
- todo: looper
schedule: 15s
ts: Thu Mar 24 09:04:51 MDT 2022
- todo: loop
schedule: 10s
ts: Thu Mar 24 09:06:59 MDT 2022
- todo: due
schedule: "2022-02-01"
ts: Thu Mar 24 09:15:42 MDT 2022
- todo: due
schedule: "2022-02-01"
ts: Thu Mar 24 09:16:53 MDT 2022
- todo: due
schedule: "2022-03-01"
ts: Thu Mar 24 09:17:07 MDT 2022

10
go.mod
View File

@@ -1,4 +1,4 @@
module pttodo module gogs.inhome.blapointe.com/bel/pttodo
go 1.17 go 1.17
@@ -6,11 +6,3 @@ require (
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )
require (
github.com/bytbox/go-pop3 v0.0.0-20120201222208-3046caf0763e // indirect
github.com/emersion/go-imap v1.2.0 // indirect
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 // indirect
golang.org/x/text v0.3.7 // indirect
)

12
go.sum
View File

@@ -1,17 +1,5 @@
github.com/bytbox/go-pop3 v0.0.0-20120201222208-3046caf0763e h1:mQTN05gz0rDZSABqKMzAPMb5ATWcvvdMljRzEh0LjBo=
github.com/bytbox/go-pop3 v0.0.0-20120201222208-3046caf0763e/go.mod h1:alXX+s7a4cKaIprgjeEboqi4Tm7XR/HXEwUTxUV/ywU=
github.com/emersion/go-imap v1.2.0 h1:lyUQ3+EVM21/qbWE/4Ya5UG9r5+usDxlg4yfp3TgHFA=
github.com/emersion/go-imap v1.2.0/go.mod h1:Qlx1FSx2FTxjnjWpIlVNEuX+ylerZQNFE5NsmKFSejY=
github.com/emersion/go-message v0.15.0/go.mod h1:wQUEfE+38+7EW8p8aZ96ptg6bAb1iwdgej19uXASlE4=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 h1:OJyUGMJTzHTd1XQp98QTaHernxMYzRaOasRir9hUlFQ=
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21/go.mod h1:iL2twTeMvZnrg54ZoPDNfJaJaqy0xIQFuBdrLsmspwQ=
github.com/emersion/go-textwrapper v0.0.0-20200911093747-65d896831594/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=

View File

@@ -22,12 +22,14 @@ func (root Root) Equals(other Root) bool {
func (root *Root) AutoMove() { func (root *Root) AutoMove() {
root.MoveScheduledToTodo() root.MoveScheduledToTodo()
//root.MoveTodoToScheduled() root.MoveTodoToScheduled()
} }
func (root *Root) MoveTodoToScheduled() { func (root *Root) MoveTodoToScheduled() {
for i := len(root.Todo) - 1; i >= 0; i-- { for i := len(root.Todo) - 1; i >= 0; i-- {
if root.Todo[i].Schedule != "" && !root.Todo[i].Triggered() { if !root.Todo[i].Schedule.isFixedFuture() {
continue
}
root.Scheduled = append(root.Scheduled, root.Todo[i]) root.Scheduled = append(root.Scheduled, root.Todo[i])
for j := i; j < len(root.Todo)-1; j++ { for j := i; j < len(root.Todo)-1; j++ {
root.Todo[j] = root.Todo[j+1] root.Todo[j] = root.Todo[j+1]
@@ -35,7 +37,6 @@ func (root *Root) MoveTodoToScheduled() {
root.Todo = root.Todo[:len(root.Todo)-1] root.Todo = root.Todo[:len(root.Todo)-1]
} }
} }
}
func (root *Root) MoveScheduledToTodo() { func (root *Root) MoveScheduledToTodo() {
for i := len(root.Scheduled) - 1; i >= 0; i-- { for i := len(root.Scheduled) - 1; i >= 0; i-- {

View File

@@ -25,6 +25,42 @@ func (schedule Schedule) Next(t time.Time) (time.Time, error) {
return scheduler.next(t) return scheduler.next(t)
} }
func (schedule Schedule) isFixedFuture() bool {
if !schedule.isFixed() {
return false
}
return schedule.isFuture()
}
func (schedule Schedule) isFixed() bool {
if schedule.empty() {
return false
}
scheduler := schedulerFactory(string(schedule))
switch scheduler.(type) {
case scheduleEZDate, scheduleDue:
default:
return false
}
return true
}
func (schedule Schedule) isFuture() bool {
if schedule.empty() {
return false
}
scheduler := schedulerFactory(string(schedule))
t, err := scheduler.next(time.Now())
if err != nil {
return false
}
return time.Now().Before(t)
}
func (schedule Schedule) empty() bool {
return string(schedule) == ""
}
type scheduler interface { type scheduler interface {
next(time.Time) (time.Time, error) next(time.Time) (time.Time, error)
} }

View File

@@ -130,3 +130,60 @@ func TestSchedulerFactory(t *testing.T) {
} }
}) })
} }
func TestScheduleIsFixedFuture(t *testing.T) {
cases := map[string]struct {
input string
want bool
}{
"empty": {
input: "",
want: false,
},
"cron": {
input: "* * * * *",
want: false,
},
"duration": {
input: "1m",
want: false,
},
"due past": {
input: "123",
want: false,
},
"due future": {
input: "9648154541",
want: true,
},
"ez date short past": {
input: "2000-01-02",
want: false,
},
"ez date short future": {
input: "2100-01-02",
want: true,
},
"ez date long past": {
input: "2000-01-02T01",
want: false,
},
"ez date long future": {
input: "2100-01-02T02",
want: true,
},
}
for name, d := range cases {
c := d
t.Run(name, func(t *testing.T) {
schedule := Schedule(c.input)
got := schedule.isFixedFuture()
if got != c.want {
gotFuture := schedule.isFuture()
gotFixed := schedule.isFixed()
t.Errorf("want %v, got %v = %v && %v", c.want, got, gotFuture, gotFixed)
}
})
}
}