Compare commits
15 Commits
1d958e8a52
...
v0.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a54ccae4c2 | ||
|
|
a27d5c38d7 | ||
|
|
cb4886992a | ||
|
|
15c5f03ccf | ||
|
|
b82f11c248 | ||
|
|
3c9b34202b | ||
|
|
967a02c90a | ||
|
|
3ed7d8cd9e | ||
|
|
492e0af993 | ||
|
|
10b95672e3 | ||
|
|
183f39bd2a | ||
|
|
24154df995 | ||
|
|
f7dac79233 | ||
|
|
8c45d4a7df | ||
|
|
1e3f24b4d5 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,6 +3,3 @@ todo-server-yaml
|
||||
cmd/cmd
|
||||
cmd/cli
|
||||
cmd/pttodo/pttodo
|
||||
cmd/pttodo-cli/pttodo-cli
|
||||
cmd/pttodo-cli
|
||||
pttodoer/target
|
||||
|
||||
36
cmd/add.go
36
cmd/add.go
@@ -1,36 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func add(config *config) error {
|
||||
if config.add == "" {
|
||||
return nil
|
||||
}
|
||||
v := pttodo.Todo{
|
||||
Todo: config.add,
|
||||
Schedule: pttodo.Schedule(config.addSchedule),
|
||||
Tags: config.addTags,
|
||||
}
|
||||
return _add(config.Targets()[0], v)
|
||||
}
|
||||
|
||||
func _add(filepath string, todo pttodo.Todo) error {
|
||||
target := fmt.Sprintf("%s.todo.%s", filepath, uuid.New().String())
|
||||
|
||||
c, err := yaml.Marshal([]pttodo.Todo{todo})
|
||||
if err != nil {
|
||||
return err
|
||||
} else if err := ioutil.WriteFile(target, c, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type config struct {
|
||||
target string
|
||||
root string
|
||||
tags []string
|
||||
search string
|
||||
edit bool
|
||||
add string
|
||||
addSchedule string
|
||||
addTags string
|
||||
}
|
||||
|
||||
func getConfig() config {
|
||||
defaultFilepath := os.Getenv("PTTODO_FILE")
|
||||
if defaultFilepath == "" {
|
||||
defaultFilepath = "./todo.yaml"
|
||||
}
|
||||
|
||||
var config config
|
||||
flag.StringVar(&config.target, "f", defaultFilepath, "($PTTODO_FILE) path to yaml file or dir (starting with root then alphabetical for dir)")
|
||||
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
|
||||
flag.StringVar(&tagss, "tags", "", "csv of all tags to find, -x to invert")
|
||||
flag.StringVar(&config.search, "search", "", "fts case insensitive")
|
||||
flag.BoolVar(&config.edit, "e", false, "edit file")
|
||||
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()
|
||||
|
||||
config.tags = strings.Split(tagss, ",")
|
||||
|
||||
config.Targets()
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
func (config config) Targets() []string {
|
||||
result, err := config.targets()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sort.Strings(result)
|
||||
for i := range result {
|
||||
if path.Base(result[i]) == "root.yaml" {
|
||||
newresult := append([]string{result[i]}, result[:i]...)
|
||||
newresult = append(newresult, result[i+1:]...)
|
||||
result = newresult
|
||||
break
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (config config) targets() ([]string, error) {
|
||||
patterns := []string{config.target, fmt.Sprintf("%s.*", config.target)}
|
||||
isDir := false
|
||||
if stat, err := os.Stat(config.target); err == nil {
|
||||
isDir = stat.IsDir()
|
||||
}
|
||||
if isDir {
|
||||
patterns = []string{fmt.Sprintf("%s/*", config.target)}
|
||||
}
|
||||
|
||||
result := make([]string, 0, 1)
|
||||
for _, pattern := range patterns {
|
||||
results, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range results {
|
||||
if stat, err := os.Stat(results[i]); err != nil {
|
||||
return nil, err
|
||||
} else if !stat.IsDir() {
|
||||
result = append(result, results[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(result) == 0 {
|
||||
if isDir {
|
||||
return []string{path.Join(config.target, "root.yaml")}, nil
|
||||
}
|
||||
return []string{config.target}, nil
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConfigTargets(t *testing.T) {
|
||||
touch := func(t *testing.T, p string) {
|
||||
if err := os.WriteFile(p, nil, os.ModePerm); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
cases := map[string]struct {
|
||||
setup func(*testing.T, string)
|
||||
given string
|
||||
want []string
|
||||
}{
|
||||
"does not exist": {
|
||||
given: "x",
|
||||
want: []string{"x"},
|
||||
},
|
||||
"one file": {
|
||||
setup: func(t *testing.T, d string) {
|
||||
touch(t, path.Join(d, "x"))
|
||||
},
|
||||
given: "x",
|
||||
want: []string{"x"},
|
||||
},
|
||||
"two files": {
|
||||
setup: func(t *testing.T, d string) {
|
||||
touch(t, path.Join(d, "a"))
|
||||
touch(t, path.Join(d, "root.yaml"))
|
||||
touch(t, path.Join(d, "z"))
|
||||
},
|
||||
given: "",
|
||||
want: []string{"root.yaml", "a", "z"},
|
||||
},
|
||||
"empty dir": {
|
||||
setup: func(t *testing.T, d string) {
|
||||
os.Mkdir(path.Join(d, "x"), os.ModePerm)
|
||||
},
|
||||
given: "x",
|
||||
want: []string{"root.yaml"},
|
||||
},
|
||||
"dir": {
|
||||
setup: func(t *testing.T, d string) {
|
||||
os.Mkdir(path.Join(d, "x"), os.ModePerm)
|
||||
touch(t, path.Join(d, "x", "a"))
|
||||
touch(t, path.Join(d, "x", "a.todo.xyz"))
|
||||
touch(t, path.Join(d, "x", "b"))
|
||||
},
|
||||
given: "x",
|
||||
want: []string{"a", "a.todo.xyz", "b"},
|
||||
},
|
||||
}
|
||||
|
||||
for name, d := range cases {
|
||||
c := d
|
||||
t.Run(name, func(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
if c.setup != nil {
|
||||
c.setup(t, d)
|
||||
}
|
||||
config := config{target: path.Join(d, c.given)}
|
||||
got := config.Targets()
|
||||
for i := range got {
|
||||
got[i] = path.Base(got[i])
|
||||
}
|
||||
for i := range c.want {
|
||||
c.want[i] = path.Base(c.want[i])
|
||||
}
|
||||
|
||||
t.Logf("want\n\t%+v, got \n\t%+v", c.want, got)
|
||||
if len(got) != len(c.want) {
|
||||
t.Error(c.want, got)
|
||||
}
|
||||
for i := range got {
|
||||
if got[i] != c.want[i] {
|
||||
t.Errorf("[%d] wanted %s, got %s", i, c.want[i], got[i])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
44
cmd/dump.go
44
cmd/dump.go
@@ -1,44 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func dump(config config) error {
|
||||
return _dump(os.Stdout, config.Targets(), config.tags, config.search, config.root)
|
||||
}
|
||||
|
||||
func _dump(writer io.Writer, filepaths []string, tags []string, search, rootDisplay string) error {
|
||||
root, err := pttodo.NewRootFromFiles(filepaths...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, x := range []*[]pttodo.Todo{
|
||||
&root.Todo,
|
||||
&root.Scheduled,
|
||||
&root.Done,
|
||||
} {
|
||||
y := pttodo.Todos(*x)
|
||||
y = y.LikeTags(tags)
|
||||
y = y.LikeSearch(search)
|
||||
*x = y
|
||||
}
|
||||
|
||||
var v interface{} = root
|
||||
switch rootDisplay {
|
||||
case DUMP_TODO:
|
||||
v = root.Todo
|
||||
case DUMP_SCHEDULED:
|
||||
v = root.Scheduled
|
||||
case DUMP_DONE:
|
||||
v = root.Done
|
||||
default:
|
||||
}
|
||||
|
||||
return yaml.NewEncoder(writer).Encode(v)
|
||||
}
|
||||
262
cmd/edit.go
262
cmd/edit.go
@@ -1,262 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
|
||||
"github.com/google/uuid"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func edit(config *config) error {
|
||||
if !config.edit {
|
||||
return nil
|
||||
}
|
||||
return _edit(config.Targets())
|
||||
}
|
||||
|
||||
func _edit(filepaths []string) error {
|
||||
editableDir, err := inEditableDirAsTodos(filepaths)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := modifyEditableDir(editableDir, func() error {
|
||||
files, err := listDir(editableDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, p := range files {
|
||||
if _, err := pttodo.NewTodosFromFile(p); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
editedFiles, err := listDir(editableDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
edits := map[string]string{}
|
||||
for _, editedFile := range editedFiles {
|
||||
edits[path.Base(editedFile)] = editedFile
|
||||
|
||||
edited, err := pttodo.NewTodosFromFile(editedFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
original, err := pttodo.NewRootFromFile(func() string {
|
||||
for _, f := range filepaths {
|
||||
if path.Base(f) == path.Base(editedFile) {
|
||||
return f
|
||||
}
|
||||
}
|
||||
return "/dev/null"
|
||||
}())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
editedIDs := map[string]int{}
|
||||
for i := range edited {
|
||||
editedIDs[edited[i].ID()] = 1
|
||||
}
|
||||
for i := range original.Todo {
|
||||
if _, ok := editedIDs[original.Todo[i].ID()]; ok {
|
||||
continue
|
||||
}
|
||||
original.Todo[i].TS = pttodo.TS(time.Now().Unix())
|
||||
if string(original.Todo[i].Schedule) != "" && !original.Todo[i].Triggered() {
|
||||
original.Scheduled = append(original.Scheduled, original.Todo[i])
|
||||
}
|
||||
original.Done = append(original.Done, original.Todo[i])
|
||||
}
|
||||
original.Todo = edited
|
||||
original.AutoMove()
|
||||
|
||||
if err := func() error {
|
||||
f, err := os.Create(editedFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return yaml.NewEncoder(f).Encode(original)
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
dir := ""
|
||||
for _, f := range filepaths {
|
||||
if edited, ok := edits[path.Base(f)]; ok {
|
||||
if err := os.Rename(edited, f); err != nil {
|
||||
return err
|
||||
}
|
||||
delete(edits, path.Base(f))
|
||||
} else if err := os.Remove(f); err != nil {
|
||||
return err
|
||||
}
|
||||
dir = path.Dir(f)
|
||||
}
|
||||
|
||||
for base, editedFile := range edits {
|
||||
f := path.Join(dir, base)
|
||||
if _, err := os.Stat(f); err == nil {
|
||||
f = fmt.Sprintf("%s.todo.%s", f, uuid.New().String())
|
||||
}
|
||||
if err := os.Rename(editedFile, f); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func inEditableDirAsTodos(filepaths []string) (string, error) {
|
||||
tempDir, err := ioutil.TempDir(os.TempDir(), "edit-pttodo-*")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return tempDir, copyTodoToDir(tempDir, filepaths)
|
||||
}
|
||||
|
||||
func copyTodoToDir(d string, filepaths []string) error {
|
||||
inboxes := map[string][]string{}
|
||||
for _, target := range filepaths {
|
||||
p := path.Join(d, path.Base(target))
|
||||
if strings.Contains(path.Base(target), ".todo.") {
|
||||
p := path.Join(d, strings.Split(path.Base(p), ".todo")[0])
|
||||
inboxes[p] = append(inboxes[p], target)
|
||||
continue
|
||||
}
|
||||
if root, err := pttodo.NewRootFromFile(target); err != nil {
|
||||
return err
|
||||
} else if b, err := yaml.Marshal(root.Todo); err != nil {
|
||||
return err
|
||||
} else if err := os.WriteFile(p, b, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for p, inboxes := range inboxes {
|
||||
inboxRoot := pttodo.Root{}
|
||||
for _, inbox := range inboxes {
|
||||
subInboxRoot, err := pttodo.NewRootFromFile(inbox)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
inboxRoot.MergeIn(pttodo.Root{Todo: subInboxRoot.Todo})
|
||||
inboxRoot.MergeIn(pttodo.Root{Todo: subInboxRoot.Scheduled})
|
||||
}
|
||||
|
||||
root, err := pttodo.NewRootFromFile(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
root.MergeIn(pttodo.Root{Todo: inboxRoot.Todo})
|
||||
root.MergeIn(pttodo.Root{Todo: inboxRoot.Scheduled})
|
||||
|
||||
if b, err := yaml.Marshal(root.Todo); err != nil {
|
||||
return err
|
||||
} else if err := os.WriteFile(p, b, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func modifyEditableDir(d string, check func() error) error {
|
||||
for {
|
||||
if err := vimd(d); err != nil {
|
||||
return err
|
||||
}
|
||||
err := check()
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
log.Printf("%s, press <Enter> to resume editing", err)
|
||||
b := make([]byte, 1)
|
||||
if _, err := os.Stdin.Read(b); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func vimd(d string) error {
|
||||
bin := "vim"
|
||||
editorbin, err := exec.LookPath(bin)
|
||||
if err != nil {
|
||||
editorbin, err = exec.LookPath("vi")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args := []string{editorbin, "-p"}
|
||||
files, err := listDir(d)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, files...)
|
||||
cpid, err := syscall.ForkExec(
|
||||
editorbin,
|
||||
args,
|
||||
&syscall.ProcAttr{
|
||||
Dir: d,
|
||||
Env: os.Environ(),
|
||||
Files: []uintptr{os.Stdin.Fd(), os.Stdout.Fd(), os.Stderr.Fd()},
|
||||
Sys: nil,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
proc, err := os.FindProcess(cpid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
state, err := proc.Wait()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if exitCode := state.ExitCode(); exitCode != 0 {
|
||||
return fmt.Errorf("bad exit code on vim: %d, state: %+v", exitCode, state)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func listDir(dname string) ([]string, error) {
|
||||
entries, err := os.ReadDir(dname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
paths := make([]string, 0, len(entries))
|
||||
for i := range entries {
|
||||
if entries[i].IsDir() {
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(path.Base(entries[i].Name()), ".") {
|
||||
continue
|
||||
}
|
||||
paths = append(paths, path.Join(dname, entries[i].Name()))
|
||||
}
|
||||
sort.Slice(paths, func(i, j int) bool {
|
||||
if path.Base(paths[i]) == "root.yaml" {
|
||||
return true
|
||||
}
|
||||
return paths[i] < paths[j]
|
||||
})
|
||||
return paths, nil
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestListDir(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
want := []string{}
|
||||
for i := 0; i < 3; i++ {
|
||||
p := path.Join(d, strconv.Itoa(i))
|
||||
ioutil.WriteFile(p, []byte{}, os.ModePerm)
|
||||
want = append(want, p)
|
||||
}
|
||||
os.Mkdir(path.Join(d, "d"), os.ModePerm)
|
||||
|
||||
got, err := listDir(d)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if fmt.Sprint(want) != fmt.Sprint(got) {
|
||||
t.Fatal(want, got)
|
||||
}
|
||||
}
|
||||
13
cmd/go.mod
13
cmd/go.mod
@@ -1,13 +0,0 @@
|
||||
module pttodo-cli
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
gitea.inhome.blapointe.com/gogs/pttodo v0.0.0-20231109151914-5d74b458d542
|
||||
github.com/google/uuid v1.3.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
||||
require github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
|
||||
replace gogs.inhome.blapointe.com/gogs/pttodo => ./..
|
||||
102
cmd/main.go
102
cmd/main.go
@@ -1,102 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"gitea.inhome.blapointe.com/gogs/pttodo/pttodo"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
const (
|
||||
DUMP_ALL = "all"
|
||||
DUMP_TODO = "todo"
|
||||
DUMP_SCHEDULED = "scheduled"
|
||||
DUMP_DONE = "done"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := _main(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func _main() error {
|
||||
config := getConfig()
|
||||
if err := add(&config); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := edit(&config); err != nil {
|
||||
return err
|
||||
}
|
||||
return dump(config)
|
||||
}
|
||||
|
||||
func merge(filepath string, mergeTargetFilePath string) error {
|
||||
baseReader, err := filePathReader(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
baseB, err := ioutil.ReadAll(baseReader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mergingReader, err := filePathReader(mergeTargetFilePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mergingB, err := ioutil.ReadAll(mergingReader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var base, merging pttodo.Root
|
||||
if err := yaml.Unmarshal(baseB, &base); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := yaml.Unmarshal(mergingB, &merging); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
base.MergeIn(merging)
|
||||
|
||||
tmppath, err := marshalRootToTempFile(base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Rename(tmppath, filepath)
|
||||
}
|
||||
|
||||
func marshalRootToTempFile(root pttodo.Root) (string, error) {
|
||||
f, err := ioutil.TempFile(os.TempDir(), "tmp")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
f.Close()
|
||||
os.Remove(f.Name())
|
||||
b, err := yaml.Marshal(root)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
filepath := f.Name() + ".yaml"
|
||||
err = ioutil.WriteFile(filepath, b, os.ModePerm)
|
||||
return filepath, err
|
||||
}
|
||||
|
||||
func filePathReader(path string) (io.Reader, error) {
|
||||
if path == "-" {
|
||||
return os.Stdin, nil
|
||||
}
|
||||
b, err := ioutil.ReadFile(path)
|
||||
if os.IsNotExist(err) {
|
||||
return bytes.NewReader([]byte("{}")), nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bytes.NewReader(b), nil
|
||||
}
|
||||
172
cmd/pttodo-cli/cli.go
Normal file
172
cmd/pttodo-cli/cli.go
Normal file
@@ -0,0 +1,172 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"local/pt-todo-server/pttodo"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"syscall"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := _main(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func _main() error {
|
||||
defaultFilepath, ok := os.LookupEnv("PTTODO_FILE")
|
||||
if !ok {
|
||||
defaultFilepath = "-"
|
||||
}
|
||||
filepath := flag.String("f", defaultFilepath, "($PTTODO_FILE) path to yaml file")
|
||||
e := flag.Bool("e", false, "edit file")
|
||||
dry := flag.Bool("dry", false, "dry run")
|
||||
flag.Parse()
|
||||
if *e {
|
||||
if err := edit(*dry, *filepath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return dump(*dry, os.Stdout, *filepath)
|
||||
}
|
||||
|
||||
func edit(dry bool, filepath string) error {
|
||||
var tempFile string
|
||||
cp := func() error {
|
||||
f, err := ioutil.TempFile(os.TempDir(), path.Base(filepath))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(filepath); err == nil {
|
||||
g, err := os.Open(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := io.Copy(f, g); err != nil {
|
||||
return err
|
||||
}
|
||||
g.Close()
|
||||
}
|
||||
f.Close()
|
||||
tempFile = f.Name() + ".yaml"
|
||||
return os.Rename(f.Name(), tempFile)
|
||||
}
|
||||
vi := func() error {
|
||||
bin := "vim"
|
||||
if editor := os.Getenv("EDITOR"); editor != "" {
|
||||
bin = editor
|
||||
}
|
||||
editorbin, err := exec.LookPath(bin)
|
||||
if err != nil {
|
||||
editorbin, err = exec.LookPath("vi")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args := []string{editorbin, tempFile}
|
||||
cpid, err := syscall.ForkExec(
|
||||
editorbin,
|
||||
args,
|
||||
&syscall.ProcAttr{
|
||||
Dir: "",
|
||||
Env: os.Environ(),
|
||||
Files: []uintptr{os.Stdin.Fd(), os.Stdout.Fd(), os.Stderr.Fd()},
|
||||
Sys: nil,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
proc, err := os.FindProcess(cpid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
state, err := proc.Wait()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if exitCode := state.ExitCode(); exitCode != 0 {
|
||||
return fmt.Errorf("bad exit code on vim: %d, state: %+v", exitCode, state)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
verify := func() error {
|
||||
if err := dump(true, io.Discard, tempFile); err != nil {
|
||||
return fmt.Errorf("failed to verify %s: %v", tempFile, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
save := func() error {
|
||||
if dry {
|
||||
log.Printf("would've saved %s as %s", tempFile, filepath)
|
||||
return nil
|
||||
}
|
||||
return os.Rename(tempFile, filepath)
|
||||
}
|
||||
|
||||
for _, foo := range []func() error{cp, vi, verify, save} {
|
||||
if err := foo(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if !dry {
|
||||
os.Remove(tempFile)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dump(dry bool, writer io.Writer, filepath string) error {
|
||||
var reader io.Reader
|
||||
if filepath == "-" {
|
||||
reader = os.Stdin
|
||||
} else {
|
||||
b, err := ioutil.ReadFile(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reader = bytes.NewReader(b)
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var root pttodo.Root
|
||||
if err := yaml.Unmarshal(b, &root); err != nil {
|
||||
return err
|
||||
}
|
||||
root.MoveScheduledToTodo()
|
||||
|
||||
var v interface{} = root
|
||||
switch flag.Arg(0) {
|
||||
case "":
|
||||
case "todo":
|
||||
v = root.Todo
|
||||
case "scheduled":
|
||||
v = root.Scheduled
|
||||
case "done":
|
||||
v = root.Done
|
||||
}
|
||||
b2, err := yaml.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(writer, "%s\n", b2)
|
||||
|
||||
if dry {
|
||||
return nil
|
||||
}
|
||||
|
||||
return os.WriteFile(filepath, b2, os.ModePerm)
|
||||
}
|
||||
12
cmd/pttodo-cli/go.mod
Normal file
12
cmd/pttodo-cli/go.mod
Normal file
@@ -0,0 +1,12 @@
|
||||
module pttodo-cli
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
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
|
||||
|
||||
replace local/pt-todo-server => ../../
|
||||
@@ -1,7 +1,3 @@
|
||||
gitea.inhome.blapointe.com/gogs/pttodo v0.0.0-20231109151914-5d74b458d542 h1:eOWrA2hEQoyu413vbdXbEXHLXEX2TVBXjWawlWndFhg=
|
||||
gitea.inhome.blapointe.com/gogs/pttodo v0.0.0-20231109151914-5d74b458d542/go.mod h1:9CFZf/SSod0Z/8WvbmOI4gEzy6xGpBQAq8coVNncNvk=
|
||||
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/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
4
cmd/testdata/1.yaml
vendored
4
cmd/testdata/1.yaml
vendored
@@ -1,4 +0,0 @@
|
||||
todo:
|
||||
- "1"
|
||||
scheduled: []
|
||||
done: []
|
||||
4
cmd/testdata/2.yaml
vendored
4
cmd/testdata/2.yaml
vendored
@@ -1,4 +0,0 @@
|
||||
todo:
|
||||
- "2"
|
||||
scheduled: []
|
||||
done: []
|
||||
4
cmd/testdata/3.yaml
vendored
4
cmd/testdata/3.yaml
vendored
@@ -1,4 +0,0 @@
|
||||
todo:
|
||||
- "3"
|
||||
scheduled: []
|
||||
done: []
|
||||
17
cmd/testdata/root.yaml
vendored
17
cmd/testdata/root.yaml
vendored
@@ -1,17 +0,0 @@
|
||||
todo:
|
||||
- root
|
||||
- stub
|
||||
scheduled:
|
||||
- todo: abc
|
||||
schedule: "2024-01-01"
|
||||
ts: Thu Nov 9 07:49:59 MST 2023
|
||||
- todo: "1"
|
||||
schedule: "2024-01-02"
|
||||
ts: Thu Nov 9 07:51:13 MST 2023
|
||||
- todo: "1"
|
||||
schedule: "2024-01-02"
|
||||
ts: Thu Nov 9 07:51:28 MST 2023
|
||||
- todo: "1"
|
||||
schedule: "2024-01-02"
|
||||
ts: Thu Nov 9 07:51:36 MST 2023
|
||||
done: []
|
||||
10
cmd/testdata/test.yaml
vendored
10
cmd/testdata/test.yaml
vendored
@@ -1,10 +0,0 @@
|
||||
todo:
|
||||
- hi20890
|
||||
- hi
|
||||
- b
|
||||
- todo: loop
|
||||
schedule: 10s
|
||||
- todo: past
|
||||
schedule: "2000-01-02"
|
||||
scheduled: []
|
||||
done: []
|
||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module gitea.inhome.blapointe.com/gogs/pttodo
|
||||
module pttodo
|
||||
|
||||
go 1.17
|
||||
|
||||
|
||||
111
pttodo/root.go
111
pttodo/root.go
@@ -1,90 +1,11 @@
|
||||
package pttodo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type Root struct {
|
||||
Todo []Todo
|
||||
Scheduled []Todo
|
||||
Done []Todo
|
||||
}
|
||||
|
||||
func NewRootFromFiles(p ...string) (Root, error) {
|
||||
var result Root
|
||||
for _, p := range p {
|
||||
subroot, err := NewRootFromFile(p)
|
||||
if err != nil {
|
||||
return Root{}, err
|
||||
}
|
||||
result.MergeIn(subroot)
|
||||
}
|
||||
result.AutoMove()
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func NewRootFromFile(p string) (Root, error) {
|
||||
if b, err := os.ReadFile(p); err == nil && len(bytes.TrimSpace(b)) == 0 {
|
||||
return Root{}, nil
|
||||
}
|
||||
|
||||
f, err := os.Open(p)
|
||||
if os.IsNotExist(err) {
|
||||
return Root{}, nil
|
||||
}
|
||||
if err != nil {
|
||||
return Root{}, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var result Root
|
||||
if err := yaml.NewDecoder(f).Decode(&result); err != nil {
|
||||
todos, err2 := NewTodosFromFile(p)
|
||||
if err2 != nil {
|
||||
return Root{}, err
|
||||
}
|
||||
result.Todo = todos
|
||||
}
|
||||
|
||||
result.AutoMove()
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (root Root) Equals(other Root) bool {
|
||||
for i, slice := range [][2][]Todo{
|
||||
[2][]Todo{root.Todo, other.Todo},
|
||||
[2][]Todo{root.Scheduled, other.Scheduled},
|
||||
[2][]Todo{root.Done, other.Done},
|
||||
} {
|
||||
_ = i
|
||||
if !equalTodoSlices(slice[0], slice[1]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (root *Root) AutoMove() {
|
||||
root.MoveScheduledToTodo()
|
||||
root.MoveTodoToScheduled()
|
||||
}
|
||||
|
||||
func (root *Root) MoveTodoToScheduled() {
|
||||
for i := len(root.Todo) - 1; i >= 0; i-- {
|
||||
if !root.Todo[i].Schedule.isFixedFuture() {
|
||||
continue
|
||||
}
|
||||
root.Scheduled = append(root.Scheduled, root.Todo[i])
|
||||
for j := i; j < len(root.Todo)-1; j++ {
|
||||
root.Todo[j] = root.Todo[j+1]
|
||||
}
|
||||
root.Todo = root.Todo[:len(root.Todo)-1]
|
||||
}
|
||||
}
|
||||
|
||||
func (root *Root) MoveScheduledToTodo() {
|
||||
for i := len(root.Scheduled) - 1; i >= 0; i-- {
|
||||
if root.Scheduled[i].Triggered() {
|
||||
@@ -97,35 +18,3 @@ func (root *Root) MoveScheduledToTodo() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (root *Root) MergeIn(root2 Root) {
|
||||
for _, listPair := range [][2]*[]Todo{
|
||||
[2]*[]Todo{&root.Todo, &root2.Todo},
|
||||
[2]*[]Todo{&root.Scheduled, &root2.Scheduled},
|
||||
[2]*[]Todo{&root.Done, &root2.Done},
|
||||
} {
|
||||
for _, candidate := range *listPair[1] {
|
||||
found := false
|
||||
for i := range *listPair[0] {
|
||||
found = found || ((*listPair[0])[i].Todo == candidate.Todo)
|
||||
}
|
||||
if !found {
|
||||
*listPair[0] = append(*listPair[0], candidate)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (root Root) MarshalYAML() (interface{}, error) {
|
||||
for i := range root.Todo {
|
||||
root.Todo[i].writeTS = false
|
||||
}
|
||||
for i := range root.Scheduled {
|
||||
root.Scheduled[i].writeTS = true
|
||||
}
|
||||
for i := range root.Done {
|
||||
root.Done[i].writeTS = true
|
||||
}
|
||||
type Alt Root
|
||||
return (Alt)(root), nil
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
package pttodo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func TestJSONRoot(t *testing.T) {
|
||||
@@ -27,8 +21,6 @@ func TestJSONRoot(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
} else if fmt.Sprint(root) != fmt.Sprint(root2) {
|
||||
t.Fatal(root, root2)
|
||||
} else if !root.Equals(root2) {
|
||||
t.Fatal(root2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,160 +92,7 @@ func TestRootMoveScheduledToTodo(t *testing.T) {
|
||||
got.MoveScheduledToTodo()
|
||||
if fmt.Sprintf("%+v", got) != fmt.Sprintf("%+v", want) {
|
||||
t.Fatalf("want \n\t%+v, got \n\t%+v", want, got)
|
||||
} else if !got.Equals(want) {
|
||||
t.Fatalf("want \n\t%+v, got \n\t%+v", want, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeRoots(t *testing.T) {
|
||||
root0yaml := `
|
||||
todo:
|
||||
- a
|
||||
- b
|
||||
- todo: c
|
||||
- todo: d
|
||||
tags: a
|
||||
- exclusive to 0
|
||||
`
|
||||
root1yaml := `
|
||||
todo:
|
||||
- a
|
||||
- b
|
||||
- todo: c
|
||||
- todo: d
|
||||
tags: b
|
||||
- exclusive to 1
|
||||
`
|
||||
rootWantyaml := `
|
||||
todo:
|
||||
- a
|
||||
- b
|
||||
- todo: c
|
||||
- todo: d
|
||||
tags: a
|
||||
- exclusive to 0
|
||||
- exclusive to 1
|
||||
`
|
||||
|
||||
var root0, root1, rootWant Root
|
||||
if err := yaml.Unmarshal([]byte(root0yaml), &root0); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := yaml.Unmarshal([]byte(root1yaml), &root1); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := yaml.Unmarshal([]byte(rootWantyaml), &rootWant); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
root0.MergeIn(root1)
|
||||
if fmt.Sprintf("%+v", root0) != fmt.Sprintf("%+v", rootWant) {
|
||||
t.Fatalf("want \n\t%+v, got \n\t%+v", rootWant, root0)
|
||||
} else if !root0.Equals(rootWant) {
|
||||
t.Fatalf("want \n\t%+v, got \n\t%+v", rootWant, root0)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootMarshalYAMLWriteTS(t *testing.T) {
|
||||
root := Root{
|
||||
Todo: []Todo{Todo{Todo: "todo", TS: 1, writeTS: true}},
|
||||
Scheduled: []Todo{Todo{Todo: "sched", TS: 2, writeTS: false, Schedule: "2099-01-01"}},
|
||||
Done: []Todo{Todo{Todo: "done", TS: 3, writeTS: false}},
|
||||
}
|
||||
got, err := yaml.Marshal(root)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got = bytes.TrimSpace(got)
|
||||
want := strings.TrimSpace(`
|
||||
todo:
|
||||
- todo
|
||||
scheduled:
|
||||
- todo: sched
|
||||
schedule: "2099-01-01"
|
||||
ts: Wed Dec 31 17:00:02 MST 1969
|
||||
done:
|
||||
- todo: done
|
||||
ts: Wed Dec 31 17:00:03 MST 1969
|
||||
`)
|
||||
if string(got) != want {
|
||||
t.Fatalf("want\n\t%q, got\n\t%q", want, string(got))
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootFromFile(t *testing.T) {
|
||||
cases := map[string]struct {
|
||||
given string
|
||||
want Root
|
||||
}{
|
||||
"empty": {},
|
||||
"happy": {
|
||||
given: `{"todo":["a", "b"],"scheduled":["c"], "done":[{"todo": "d"}]}`,
|
||||
want: Root{
|
||||
Todo: []Todo{
|
||||
Todo{Todo: "a"},
|
||||
Todo{Todo: "b"},
|
||||
},
|
||||
Scheduled: []Todo{
|
||||
Todo{Todo: "c"},
|
||||
},
|
||||
Done: []Todo{
|
||||
Todo{Todo: "d"},
|
||||
},
|
||||
},
|
||||
},
|
||||
"todos": {
|
||||
given: `["a", {"todo": "b"}]`,
|
||||
want: Root{
|
||||
Todo: []Todo{
|
||||
{Todo: "a"},
|
||||
{Todo: "b"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, d := range cases {
|
||||
c := d
|
||||
t.Run(name, func(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
p := path.Join(d, "input.yaml")
|
||||
if err := os.WriteFile(p, []byte(c.given), os.ModePerm); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := NewRootFromFile(p)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if fmt.Sprintf("%+v", got) != fmt.Sprintf("%+v", c.want) {
|
||||
t.Errorf("want\n\t%+v, got\n\t%+v", c.want, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootFromFiles(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
ps := []string{
|
||||
path.Join(d, "a"),
|
||||
path.Join(d, "b"),
|
||||
}
|
||||
os.WriteFile(ps[0], []byte(`["a"]`), os.ModePerm)
|
||||
os.WriteFile(ps[1], []byte(`["b"]`), os.ModePerm)
|
||||
|
||||
got, err := NewRootFromFiles(ps...)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := Root{
|
||||
Todo: []Todo{
|
||||
{Todo: "a"},
|
||||
{Todo: "b"},
|
||||
},
|
||||
}
|
||||
if fmt.Sprintf("%+v", got) != fmt.Sprintf("%+v", want) {
|
||||
t.Errorf("want\n\t%+v, got \n\t%+v", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,42 +25,6 @@ func (schedule Schedule) Next(t time.Time) (time.Time, error) {
|
||||
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 {
|
||||
next(time.Time) (time.Time, error)
|
||||
}
|
||||
@@ -73,8 +37,6 @@ func schedulerFactory(s string) scheduler {
|
||||
} else if scheduleDuePattern.MatchString(s) {
|
||||
n, _ := strconv.Atoi(s)
|
||||
return scheduleDue(n)
|
||||
} else if scheduleEZDatePattern.MatchString(s) {
|
||||
return scheduleEZDate(s)
|
||||
}
|
||||
return scheduleCron(s)
|
||||
}
|
||||
@@ -126,15 +88,3 @@ var scheduleDuePattern = regexp.MustCompile(`^[0-9]+$`)
|
||||
func (due scheduleDue) next(time.Time) (time.Time, error) {
|
||||
return TS(due).time(), nil
|
||||
}
|
||||
|
||||
// 2022-01-01
|
||||
type scheduleEZDate string
|
||||
|
||||
var scheduleEZDatePattern = regexp.MustCompile(`^[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2})?$`)
|
||||
|
||||
func (ezdate scheduleEZDate) next(time.Time) (time.Time, error) {
|
||||
if len(ezdate) == len("20xx-xx-xxTxx") {
|
||||
return time.ParseInLocation("2006-01-02T15", string(ezdate), time.Local)
|
||||
}
|
||||
return time.ParseInLocation("2006-01-02", string(ezdate), time.Local)
|
||||
}
|
||||
|
||||
@@ -50,18 +50,11 @@ func TestJSONSchedule(t *testing.T) {
|
||||
|
||||
func TestSchedulerFactory(t *testing.T) {
|
||||
start := time.Date(2000, 1, 1, 1, 1, 1, 1, time.UTC)
|
||||
someDay := time.Date(2001, 2, 3, 0, 0, 0, 0, time.UTC)
|
||||
someHour := time.Date(2001, 2, 3, 15, 0, 0, 0, time.UTC)
|
||||
cases := map[string]struct {
|
||||
input string
|
||||
want interface{}
|
||||
next time.Time
|
||||
}{
|
||||
"ezdate with hour": {
|
||||
input: `2000-01-03T15`,
|
||||
want: scheduleEZDate(`2000-01-03T15`),
|
||||
next: someHour,
|
||||
},
|
||||
"long dur": {
|
||||
input: `2h1m`,
|
||||
want: scheduleDuration("2h1m"),
|
||||
@@ -77,6 +70,11 @@ func TestSchedulerFactory(t *testing.T) {
|
||||
want: scheduleDue(1),
|
||||
next: time.Unix(1, 0),
|
||||
},
|
||||
"zero ts": {
|
||||
input: `0`,
|
||||
want: scheduleDue(0),
|
||||
next: time.Unix(0, 0),
|
||||
},
|
||||
"never": {
|
||||
input: ``,
|
||||
want: scheduleNever{},
|
||||
@@ -92,11 +90,6 @@ func TestSchedulerFactory(t *testing.T) {
|
||||
want: scheduleCron(`5 * * * *`),
|
||||
next: start.Add(time.Duration(-1*start.Nanosecond() + -1*start.Minute() + -1*start.Second())).Add(5 * time.Minute),
|
||||
},
|
||||
"ezdate": {
|
||||
input: `2000-01-03`,
|
||||
want: scheduleEZDate(`2000-01-03`),
|
||||
next: someDay,
|
||||
},
|
||||
}
|
||||
|
||||
for name, d := range cases {
|
||||
@@ -115,75 +108,4 @@ func TestSchedulerFactory(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("zero ts", func(t *testing.T) {
|
||||
got := schedulerFactory("0")
|
||||
if fmt.Sprintf("%T", scheduleDue(0)) != fmt.Sprintf("%T", got) {
|
||||
t.Fatalf("want type %T, got %T", scheduleDue(0), got)
|
||||
}
|
||||
if fmt.Sprint(scheduleDue(0)) != fmt.Sprint(got) {
|
||||
t.Fatalf("want %+v, got %+v", scheduleDue(0), got)
|
||||
}
|
||||
next, _ := got.next(start)
|
||||
if now := time.Now(); next.Sub(now) > time.Second {
|
||||
t.Fatalf("want next %+v, got %+v", now, next)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +1,17 @@
|
||||
package pttodo
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type Todo struct {
|
||||
Todo string
|
||||
TS TS
|
||||
Details string `yaml:",omitempty"`
|
||||
Schedule Schedule `yaml:",omitempty"`
|
||||
Tags string `yaml:",omitempty"`
|
||||
Subtasks []Todo `yaml:",omitempty"`
|
||||
TS TS `yaml:",omitempty"`
|
||||
writeTS bool
|
||||
}
|
||||
|
||||
func NewTodosFromFile(p string) ([]Todo, error) {
|
||||
f, err := os.Open(p)
|
||||
if os.IsNotExist(err) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
var result []Todo
|
||||
if err := yaml.NewDecoder(f).Decode(&result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (todo Todo) ID() string {
|
||||
hash := crc32.NewIEEE()
|
||||
fmt.Fprintf(hash, "%d:%s", 0, todo.Todo)
|
||||
fmt.Fprintf(hash, "%d:%s", 1, todo.Details)
|
||||
fmt.Fprintf(hash, "%d:%s", 2, todo.Schedule)
|
||||
fmt.Fprintf(hash, "%d:%s", 3, todo.Tags)
|
||||
for i := range todo.Subtasks {
|
||||
fmt.Fprintf(hash, "%d:%s", 4, todo.Subtasks[i].ID())
|
||||
}
|
||||
return base64.StdEncoding.EncodeToString(hash.Sum(nil))
|
||||
}
|
||||
|
||||
func (todo Todo) Triggered() bool {
|
||||
@@ -57,11 +21,6 @@ func (todo Todo) Triggered() bool {
|
||||
}
|
||||
|
||||
func (todo Todo) MarshalYAML() (interface{}, error) {
|
||||
if !todo.writeTS {
|
||||
todo.TS = 0
|
||||
} else {
|
||||
todo.TS = TS(todo.TS.time().Unix())
|
||||
}
|
||||
if fmt.Sprint(todo) == fmt.Sprint(Todo{Todo: todo.Todo}) {
|
||||
return todo.Todo, nil
|
||||
}
|
||||
@@ -78,37 +37,3 @@ func (todo *Todo) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
alt := (*Alt)(todo)
|
||||
return unmarshal(alt)
|
||||
}
|
||||
|
||||
func (todo Todo) Equals(other Todo) bool {
|
||||
if !equalTodoSlices(todo.Subtasks, other.Subtasks) {
|
||||
return false
|
||||
}
|
||||
if todo.TS != other.TS {
|
||||
return false
|
||||
}
|
||||
if todo.Tags != other.Tags {
|
||||
return false
|
||||
}
|
||||
if todo.Schedule != other.Schedule {
|
||||
return false
|
||||
}
|
||||
if todo.Details != other.Details {
|
||||
return false
|
||||
}
|
||||
if todo.Todo != other.Todo {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func equalTodoSlices(a, b []Todo) bool {
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
for i := range a {
|
||||
if !a[i].Equals(b[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -125,33 +125,3 @@ func TestMarshalTodo(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestTodoID(t *testing.T) {
|
||||
cases := map[string]Todo{
|
||||
"empty": Todo{},
|
||||
"todo": Todo{Todo: "abc"},
|
||||
"details": Todo{Details: "abc"},
|
||||
"todo,details": Todo{Todo: "abc", Details: "abc"},
|
||||
}
|
||||
|
||||
got := map[string]bool{}
|
||||
for name, todod := range cases {
|
||||
todo := todod
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if _, ok := got[todo.ID()]; ok {
|
||||
t.Error("dupe", todo.ID())
|
||||
}
|
||||
got[todo.ID()] = true
|
||||
t.Logf("%s: %+v", todo.ID(), todo)
|
||||
todo2 := todo
|
||||
todo2.TS = 1
|
||||
if todo.ID() != todo2.ID() {
|
||||
t.Error("ts changed")
|
||||
}
|
||||
todo2.writeTS = true
|
||||
if todo.ID() != todo2.ID() {
|
||||
t.Error("writets changed")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package pttodo
|
||||
|
||||
import "strings"
|
||||
|
||||
type Todos []Todo
|
||||
|
||||
func (todos Todos) LikeSearch(search string) Todos {
|
||||
return todos.Like(func(todo Todo) bool {
|
||||
return strings.Contains(
|
||||
strings.ToLower(todo.Todo),
|
||||
strings.ToLower(search),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
func (todos Todos) LikeTags(tags []string) Todos {
|
||||
return todos.Like(func(todo Todo) bool {
|
||||
matches := true
|
||||
for _, tag := range tags {
|
||||
str := strings.TrimLeft(tag, "-")
|
||||
want := !strings.HasPrefix(tag, "-")
|
||||
matches = matches && strings.Contains(todo.Tags, str) == want
|
||||
}
|
||||
return matches
|
||||
})
|
||||
}
|
||||
|
||||
func (todos Todos) Like(like func(Todo) bool) Todos {
|
||||
result := make(Todos, 0)
|
||||
for i := range todos {
|
||||
if like(todos[i]) {
|
||||
result = append(result, todos[i])
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package pttodo
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestTodosLikeTags(t *testing.T) {
|
||||
todos := Todos{
|
||||
{Todo: "a", Tags: "x"},
|
||||
{Todo: "b", Tags: "x,y"},
|
||||
}
|
||||
|
||||
result := todos.LikeTags([]string{"x", "-y"})
|
||||
if len(result) != 1 {
|
||||
t.Error(result)
|
||||
} else if result[0].Todo != "a" {
|
||||
t.Error(result[0].Todo)
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,6 @@ import (
|
||||
type TS int64
|
||||
|
||||
func (ts TS) time() time.Time {
|
||||
if ts == 0 {
|
||||
ts = TS(time.Now().Unix())
|
||||
}
|
||||
return time.Unix(int64(ts), 0)
|
||||
}
|
||||
|
||||
@@ -29,7 +26,8 @@ func (ts TS) MarshalYAML() (interface{}, error) {
|
||||
if ts == 0 {
|
||||
ts = TS(time.Now().Unix())
|
||||
}
|
||||
return ts.time().Format(time.UnixDate), nil
|
||||
t := time.Unix(int64(ts), 0)
|
||||
return t.Format(time.UnixDate), nil
|
||||
}
|
||||
|
||||
func (ts *TS) UnmarshalJSON(b []byte) error {
|
||||
@@ -44,7 +42,7 @@ func (ts *TS) UnmarshalYAML(unmarshaller func(interface{}) error) error {
|
||||
}
|
||||
var s string
|
||||
if err := unmarshaller(&s); err == nil {
|
||||
t, err := time.ParseInLocation(time.UnixDate, s, time.Local)
|
||||
t, err := time.Parse(time.UnixDate, s)
|
||||
*ts = TS(t.Unix())
|
||||
return err
|
||||
}
|
||||
|
||||
118
pttodoer/Cargo.lock
generated
118
pttodoer/Cargo.lock
generated
@@ -1,118 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pttodoer"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde_yaml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.200"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.200"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.9.34+deprecated"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
"unsafe-libyaml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "unsafe-libyaml"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
|
||||
@@ -1,9 +0,0 @@
|
||||
[package]
|
||||
name = "pttodoer"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serde_yaml = "0.9.34"
|
||||
@@ -1,31 +0,0 @@
|
||||
use serde_yaml;
|
||||
|
||||
fn main() {
|
||||
println!("{:?}", Task::new())
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Task(serde_yaml::Mapping);
|
||||
//pub todo: String,
|
||||
//pub when: Option<When>,
|
||||
//pub detail: Option<String>,
|
||||
//pub sub: Vec<Task>,
|
||||
|
||||
impl Task {
|
||||
fn is_due(&self) -> bool {
|
||||
assert!(false);
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[derive(Debug, Clone)]
|
||||
struct When(String);
|
||||
|
||||
impl When {
|
||||
fn is_due(&self) -> bool {
|
||||
assert!(false);
|
||||
false
|
||||
}
|
||||
}
|
||||
*/
|
||||
4
pttodoer/src/testdata/.mvp.yaml.done
vendored
4
pttodoer/src/testdata/.mvp.yaml.done
vendored
@@ -1,4 +0,0 @@
|
||||
- todo: a b and c
|
||||
schedule: * * * * *
|
||||
ts: 123
|
||||
- d e f
|
||||
@@ -1 +0,0 @@
|
||||
plaintext
|
||||
@@ -1,4 +0,0 @@
|
||||
todo: todo here
|
||||
schedule: * * * * *
|
||||
details: |
|
||||
hello world
|
||||
2
pttodoer/src/testdata/mvp.yaml
vendored
2
pttodoer/src/testdata/mvp.yaml
vendored
@@ -1,2 +0,0 @@
|
||||
- x
|
||||
- y and z
|
||||
90
todo.yaml
90
todo.yaml
@@ -1,12 +1,12 @@
|
||||
todo:
|
||||
- when merging, check for complete/incomplete and cross reference todo vs scheduled
|
||||
vs done
|
||||
- click on links when dumped via cli
|
||||
scheduled: []
|
||||
done:
|
||||
- xactions emails extend ledger,todo-server with pttodo - schedule merge inbox style
|
||||
- xactions emails extend ledger,todo-server with pttodo
|
||||
- todo: when to run scheduled modifier? like, syncthing could have conflicts if I
|
||||
modify only file on remote
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
details: |
|
||||
- if it's a web ui hook or somethin, then it'd only have file conflict if I modify without waiting
|
||||
- but thats a step back from current todo solution
|
||||
- todo: ez edit on many platforms, even offline and mobile
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
details: |
|
||||
mobile view + complete method
|
||||
collab editing of file prob resolves mobile and other stuff...
|
||||
@@ -14,69 +14,35 @@ done:
|
||||
web server access to ops
|
||||
is a web ui for mobile best solution?
|
||||
let git be smart-ish and keep latest? would provide versioning OOTB without touching raw
|
||||
- todo: when to run scheduled modifier? like, syncthing could have conflicts if I
|
||||
modify only file on remote
|
||||
details: |
|
||||
- if it's a web ui hook or somethin, then it'd only have file conflict if I modify without waiting
|
||||
- but thats a step back from current todo solution
|
||||
tags: stuffToTry,secondTag
|
||||
- what do about todo-now vs todo vs watch vs later... could do many files and manage
|
||||
outside binary, but search would suck. Good would be vendor lockin, and that's UI
|
||||
problem
|
||||
- merge multi todo files for 'inbox' style with some dedupe (probably best to just
|
||||
do this via calling pttodo-cli from script or somethin) (probably at an off hour
|
||||
so no collisions from live editing)
|
||||
- how to defer a scheduled task?
|
||||
- todo: add tag anti-search, like -tag=-notMe
|
||||
ts: Tue Jan 4 06:56:03 EST 2022
|
||||
- todo: if in todo, then omit ts field
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: merge full files to import from todo-server
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: more schedule formats, like just 2022-01-15, for deferring
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: from todo-server to pttodo format
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: add -tag to search via cli
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: ts to human readable
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: here is my really here is my really here is my really here is my really here
|
||||
is my really here is my really here is my really here is my really here is my
|
||||
really here is my really here is my really here is my really here is my really
|
||||
here is my really here is my really long string
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: vim doesnt source vimrc, so stuff like tab width and tab characters, also
|
||||
syntax highlight :(
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: crontab -e style editing to ensure good syntax
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
scheduled: []
|
||||
done:
|
||||
- ts to human readable
|
||||
- here is my really here is my really here is my really here is my really here is
|
||||
my really here is my really here is my really here is my really here is my really
|
||||
here is my really here is my really here is my really here is my really here is
|
||||
my really here is my really long string
|
||||
- vim doesnt source vimrc, so stuff like tab width and tab characters, also syntax
|
||||
highlight :(
|
||||
- crontab -e style editing to ensure good syntax
|
||||
- todo: YAML based todo
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
details: because goddamnit a year of this shit isn't significant on disk or in RAM
|
||||
for vim
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
- todo: yaml based todo for plaintext
|
||||
details: a year isnt even a mb
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
- todo: ez edit, start on many platforms
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: defer
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: schedule
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: looping
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: details
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: let UI be UI for whatever platform
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
- todo: tags
|
||||
ts: Sun Jan 2 20:44:27 EST 2022
|
||||
details: a year isnt even a mb
|
||||
- ez edit, start on many platforms
|
||||
- defer
|
||||
- schedule
|
||||
- looping
|
||||
- details
|
||||
- let UI be UI for whatever platform
|
||||
- tags
|
||||
- todo: sub tasks
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
subtasks:
|
||||
- a
|
||||
ts: Fri Dec 31 22:33:12 EST 2021
|
||||
- todo: crap losing on a bad edit hurts
|
||||
ts: Fri Dec 31 22:37:58 EST 2021
|
||||
details: |
|
||||
?
|
||||
ts: Fri Dec 31 22:37:58 EST 2021
|
||||
|
||||
Reference in New Issue
Block a user