ref: 472f09590bc0436c405234efc6d9a2b704ebeff8
parent: 31f93daa0243ea75278ba8a0c2ec6fff87215519
author: Michael Misch <michaelmisch1985@gmail.com>
date: Sat Oct 26 04:54:02 PDT 2019
Update README to remove mentions of Make
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# todo2
-This simple script makes us of Make's directed acyclic graph solving, to express TODO lists in a way that allows multiple hierarchies of parent/child relationships between different atomic tasks.
+This simple script makes us of directed acyclic graph solving, to express TODO lists in a way that allows multiple hierarchies of parent/child relationships between different atomic tasks.
Consider the following traditional TODO list.
@@ -95,8 +95,6 @@
## Managing dependancy hierarchy
-To say a particular .todo depends on another, we can manually edit the Makefile, or we can use the wrapper scripts to simplify the process.
-
`todo add` is the base command we'll be using, to add hierarchies. (A complementary `todo rm` can be used to undo anything `todo add` can do!)
To add something as a child dependency, `todo add child <parent name> <child name>`. From the above examples, you would issue `todo add child 'BUG #01209' 'BUG #92930'`, or equivilently `todo add parent 'BUG #92930' 'BUG #01209'`.
@@ -104,11 +102,11 @@
Arbitrarily many dependencies can be added between arbitrary pieces within the current working source tree.
## Commands of intrigue
- - `todo init` will create, if none exists, the backing Makefile used internally
+ - `todo init` will create, if none exists, the backing Makefile-like file used internally
- `todo list` will output a list of all current leaves in the graph, (nodes which have no pending dependencies)
- `todo listall` will list every piece of the graph in a flat structure. This is very useful in defining hierarchies on complicated TODO list
- `todo dot` can be piped to `graphviz` and friends to view your current task hierarchies, with the completed nodes elided
- (Requires https://github.com/lindenb/makefile2graph)
+ - `todo dotall` will output a complete graph of all task hierarchies
## Sharing
-The best method is to include your existing todo2-specific Makefile into your current revision system, and symbolically link it into the `$XDG_DATA_HOME/todo2/` directory.
+The best method is to include your existing todo2 main file into your current revision system, and symbolically link it into the `$XDG_DATA_HOME/todo2/myproject` directory.
--- a/command.go
+++ b/command.go
@@ -22,6 +22,7 @@
c := &command{}
if arg == "task" {
+ c.args = flag.Args()[1:]
c.runner = task
return c, nil
}
@@ -39,6 +40,8 @@
// needing to do any additional bookkeeping in the functions themselves
func (c command) setTask(arg string) error {
switch arg {
+ //case "help":
+ //c.runner = help
case "init":
c.runner = initFile
case "list":
@@ -48,10 +51,16 @@
case "dot":
c.runner = dot
case "rm":
- c.args = flag.Args()
+ if flag.NArg < 2 {
+ return errors.New("No arguments supplied to rm")
+ }
+ c.args = flag.Args()[1:]
c.runner = rm
case "add":
- c.args = flag.Args()
+ if flag.NArg < 2 {
+ return errors.New("No arguments supplied to add")
+ }
+ c.args = flag.Args()[1:]
c.runner = add
case "generate":
c.runner = generate
--- a/runners.go
+++ b/runners.go
@@ -5,10 +5,11 @@
"text/template"
)
-var tmpl = template.Must(template.New("new").Parse("{{.name}} test"))
+var tmpl = template.Must(template.New("new").Parse("# {{.name}} TODO"))
type makefile struct {
name string
+ //nodes []node
}
func initFile(c *command) error {
@@ -18,17 +19,24 @@
return err
}
defer wr.Close()
+ //TODO(halfwit): Create a more useful type here
data := &makefile{"test"}
return tmpl.Execute(wr, data)
}
func list(c *command) error {
+ // Parse makefile into DAG
+ // Pretty print the leaves
return nil
}
func listall(c *command) error {
+ // Parse makefile into DAG
+ // Pretty print everything
return nil
}
func dot(c *command) error {
+ // Parse makefile into DAG
+ // Pretty print as dot format
return nil
}
func rm(c *command) error {
--- a/task.go
+++ b/task.go
@@ -1,5 +1,6 @@
package main
func task(c *command) error {
+ switch c.args[1]
return nil
}
--- a/todo.go
+++ b/todo.go
@@ -20,5 +20,5 @@
if err != nil {
log.Fatal(err)
}
- cmd.runnerCmd()
+ cmd.runCmd()
}