github.com/lenfree/buffalo@v0.7.3-0.20170207163156-891616ea4064/examples/hello-world/grifts/routes.go (about) 1 package grifts 2 3 import ( 4 "os" 5 6 "github.com/gobuffalo/buffalo/examples/hello-world/actions" 7 mbgrift "github.com/markbates/grift/grift" 8 "github.com/olekukonko/tablewriter" 9 ) 10 11 var _ = mbgrift.Add("routes", func(c *mbgrift.Context) error { 12 a := actions.App() 13 routes := a.Routes() 14 15 table := tablewriter.NewWriter(os.Stdout) 16 table.SetHeader([]string{"Method", "Path", "Handler"}) 17 for _, r := range routes { 18 table.Append([]string{r.Method, r.Path, r.HandlerName}) 19 } 20 table.SetCenterSeparator("|") 21 table.SetAlignment(tablewriter.ALIGN_LEFT) 22 table.Render() 23 return nil 24 })