From 141a3744413cb7f59ccb633cef86348e5c00cbda Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 31 Dec 2021 16:58:08 -0500 Subject: [PATCH] eat my own dogfood, subtasks --- TODO.md | 10 +++++++++- cmd/cli.go | 4 ++-- pttodo/todo.go | 8 ++++++-- pttodo/todo_test.go | 3 ++- todo.yaml | 21 +++++++++++++++++++++ 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 todo.yaml diff --git a/TODO.md b/TODO.md index 75c4e81..debd3cd 100644 --- a/TODO.md +++ b/TODO.md @@ -5,6 +5,14 @@ Goals * YAML based todo * because goddamnit a year of this shit isn't significant on disk or in RAM for vim * ez edit on many platforms, even offline and mobile + * ez start on many platforms * defer, schedule, looping, details -* let UI be UI and plaintext be plaintext, cause I dont use ledger.scratch.com +* let UI be UI and plaintext be plaintext, cause I dont use ledger.scratch.com anyhow + * of course I can't read ledger from mobile so incomplete example there but w/e + * if mobile, then need view + complete + * else fuckit get a damned keyboard * tags + +## TODO + +See todo.yaml diff --git a/cmd/cli.go b/cmd/cli.go index d4d3003..b82a1d4 100644 --- a/cmd/cli.go +++ b/cmd/cli.go @@ -3,10 +3,10 @@ package main import ( "bytes" "flag" + "fmt" "io" "io/ioutil" "local/pt-todo-server/pttodo" - "log" "os" "gopkg.in/yaml.v2" @@ -48,6 +48,6 @@ func _main() error { if err != nil { return err } - log.Printf("%s", b2) + fmt.Printf("%s\n", b2) return nil } diff --git a/pttodo/todo.go b/pttodo/todo.go index e22a769..12241f2 100644 --- a/pttodo/todo.go +++ b/pttodo/todo.go @@ -1,6 +1,9 @@ package pttodo -import "time" +import ( + "fmt" + "time" +) type Todo struct { Todo string @@ -8,6 +11,7 @@ type Todo struct { TS TS `yaml:",omitempty"` Schedule Schedule `yaml:",omitempty"` Tags string `yaml:",omitempty"` + Subtasks []Todo `yaml:",omitempty"` } func (todo Todo) Triggered() bool { @@ -17,7 +21,7 @@ func (todo Todo) Triggered() bool { } func (todo Todo) MarshalYAML() (interface{}, error) { - if todo == (Todo{Todo: todo.Todo}) { + if fmt.Sprint(todo) == fmt.Sprint(Todo{Todo: todo.Todo}) { return todo.Todo, nil } type Alt Todo diff --git a/pttodo/todo_test.go b/pttodo/todo_test.go index 2320647..d620c71 100644 --- a/pttodo/todo_test.go +++ b/pttodo/todo_test.go @@ -2,6 +2,7 @@ package pttodo import ( "encoding/json" + "fmt" "strings" "testing" @@ -26,7 +27,7 @@ func TestJSONTodo(t *testing.T) { t.Fatal(err) } else if err := json.Unmarshal(b, &todo2); err != nil { t.Fatal(err) - } else if todo != todo2 { + } else if fmt.Sprint(todo) != fmt.Sprint(todo2) { t.Fatal(todo2) } }) diff --git a/todo.yaml b/todo.yaml new file mode 100644 index 0000000..ed75b1f --- /dev/null +++ b/todo.yaml @@ -0,0 +1,21 @@ +todo: +- todo: ez edit on many platforms, even offline and mobile + subtasks: + - mobile view + complete method +done: +- todo: YAML based todo + detail: + because goddamnit a year of this shit + isn't significant on disk or in RAM for vim +- todo: yaml based todo for plaintext + detail: a year isnt even a mb +- ez edit, start on many platforms +- defer +- schedule +- looping +- details +- todo: let UI be UI for whatever platform +- tags +- todo: sub tasks + subtasks: + - a