Example #1
0
func router() *cli.Router {
	router := cli.NewRouter()

	router.Register("image/current", &currentImage{}, "get the current image")
	router.Register("env/current", &currentEnv{}, "get the current env")
	return router
}
Example #2
0
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)
	}
}