github.com/jasonish/buffalo@v0.8.2-0.20170413145823-bacbdd415f1b/generators/newapp/templates/grifts/routes.go.tmpl (about)

     1  package grifts
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"text/tabwriter"
     7  
     8  	. "github.com/markbates/grift/grift"
     9  	"{{ .actionsPath }}"
    10  )
    11  
    12  var _ = Add("routes", func(c *Context) error {
    13  	a := actions.App()
    14  	routes := a.Routes()
    15  	w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.Debug)
    16  	fmt.Fprintln(w, "METHOD\t PATH\t HANDLER")
    17  	fmt.Fprintln(w, "------\t ----\t -------")
    18  	for _, r := range routes {
    19  		fmt.Fprintf(w, "%s\t %s\t %s\n", r.Method, r.Path, r.HandlerName)
    20  	}
    21  	w.Flush()
    22  	return nil
    23  })