diff --git a/cmd/grit/cmds.go b/cmd/grit/cmds.go index 7fb79b7..bbd875d 100644 --- a/cmd/grit/cmds.go +++ b/cmd/grit/cmds.go @@ -215,7 +215,9 @@ func cmdUncheck(cmd *cli.Cmd) { func cmdLink(cmd *cli.Cmd) { cmd.Spec = "ORIGIN TARGETS..." var ( - origin = cmd.StringArg("ORIGIN", "", "origin selector") + origin = cmd.StringArg("ORIGIN", "", + "origin selector. 'today' is a valid option and will" + + " create the node if it doesn't already exist") targets = cmd.StringsArg("TARGETS", nil, "target selector(s)") ) cmd.Action = func() { @@ -225,6 +227,11 @@ func cmdLink(cmd *cli.Cmd) { } defer a.Close() + today := time.Now().Format("2006-01-02") + if *origin == "today" { + *origin = today + } + for _, t := range *targets { if _, err := a.LinkNodes(*origin, t); err != nil { errf("Couldn't create link (%s) -> (%s): %v\n", *origin, t, err) @@ -236,7 +243,9 @@ func cmdLink(cmd *cli.Cmd) { func cmdUnlink(cmd *cli.Cmd) { cmd.Spec = "ORIGIN ( -A | -P | TARGETS... )" var ( - origin = cmd.StringArg("ORIGIN", "", "origin selector") + origin = cmd.StringArg("ORIGIN", "", + "origin selector. 'today' is a valid option and will" + + " create the node if it doesn't already exist") targets = cmd.StringsArg("TARGETS", nil, "target selector") allChildren = cmd.BoolOpt("A allChildren", false, "unlink all children of the node") @@ -250,6 +259,11 @@ func cmdUnlink(cmd *cli.Cmd) { } defer a.Close() + today := time.Now().Format("2006-01-02") + if *origin == "today" { + *origin = today + } + originNode, err := a.GetGraph(*origin) if err != nil { die(err) diff --git a/multitree/validate.go b/multitree/validate.go index 8c2c8e2..af2811e 100644 --- a/multitree/validate.go +++ b/multitree/validate.go @@ -13,7 +13,7 @@ func ValidateNodeName(name string) error { if len(name) == 0 { return errors.New("invalid node name (empty name)") } - if len(name) > 100 { + if len(name) > 200 { return errors.New("invalid node name (name too long)") } return nil