github.com/rotblauer/buffalo@v0.7.1-0.20170112214545-7aa55ef80dd3/examples/json-resource/grifts/routes.go (about) 1 package grifts 2 3 import ( 4 "os" 5 6 "github.com/gobuffalo/buffalo/examples/json-resource/actions" 7 . "github.com/markbates/grift/grift" 8 "github.com/olekukonko/tablewriter" 9 ) 10 11 var _ = Add("routes", func(c *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 })