func router() *cli.Router { router := cli.NewRouter() router.Register("image/current", ¤tImage{}, "get the current image") router.Register("env/current", ¤tEnv{}, "get the current env") return router }
func main() { router := cli.NewRouter() router.Register("entities/show", &ShowEntity{w: "foog"}, "an example action") router.Register("entities/list", &ShowEntity{w: "foog"}, "an example action") router.Register("entit/list", &ShowEntity{w: "foog", Option: "barz"}, "an example action") router.RegisterFunc("version", func() error { log.Printf("x.y"); return nil }, "show the apps version") if e := router.RunWithArgs(); e != nil { log.Fatal(e) } }