github.com/bscott/buffalo@v0.11.1/generators/grift/templates.go (about)

     1  package grift
     2  
     3  const tmplHeader = `package grifts
     4  
     5  import (
     6  	. "github.com/markbates/grift/grift"
     7  )
     8  `
     9  
    10  const tmplBody = `
    11  {{ if .opts.Namespaced }}
    12  		{{ range $index, $element := .opts.Parts }}
    13  			{{ if $.opts.Last $element}}
    14  				Desc("{{$element.File}}", "Task Description")
    15  				Add("{{$element.File}}", func(c *Context) error{
    16  						return nil
    17  				})
    18  			{{ else }}
    19  				{{if eq $index 0}}
    20  						var _ = Namespace("{{$element.File}}", func(){
    21  				{{ else }}
    22  						Namespace("{{$element.File}}", func(){
    23  				{{end}}
    24  			{{ end }}
    25  		{{ end }}
    26  		{{ range $index, $element := .opts.Parts }}
    27  				{{ if $index }} }) {{ end }}
    28  		{{ end }}
    29  {{ else }}
    30  		var _ = Desc("{{.opts.Name.File}}", "Task Description")
    31  		var _ = Add("{{.opts.Name.File}}", func(c *Context) error {
    32  				return nil
    33  		})
    34  {{ end }}`