This is a feature and bugfix release.
Major Changes
Cookoo now supports a new Route declaration syntax:
reg, router, cxt := Cookoo()
reg.AddRoute(Route{
Name: "test",
Does: Tasks{
CmdDef{
Name: "cmdDef",
Def: &mystruct{},
Using: []Param{
{Name: "funty", DefaultValue: 5},
{Name: "StrField", DefaultValue: "Batty"},
},
},
},
})
There is also experimental support for passing CmdDef instances into a route, and having the struct populated from the Params.
- EXPERIMENTAL: Added support for CmdDef, a tool for writing structs
that manage types for cookoo commands. - Added support for an alternative Route declaration syntax that does
not use method chaining. - Added support for @shutdown routes on web.Serve().
- Added safely.GoDo(cxt, GoDoer)
- NewReroute(route string) can be used to create Reroutes now.
- From() now takes an vararg of strings:
From("cxt:foo", "cxt:bar")
.
It can still take a space-delimited set of strings, too. In fact, both
can be used together:From("cxt:foo", "cxt:bar cxt:baz")
. - Added Getter interface
- Added the Get* and Has* utility functions (getter.go)
- Added GetFromFirst(string, interface) (Contextvalue, Getter) function
- Added DefaultGetter struct
- Added 'subcommand' param to cli.ParseArgs
- Added 'cli.New' and 'cli.Runner'
- Added 'fmt' package