github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/genny/info/config.go (about) 1 package info 2 3 import ( 4 "path" 5 6 "github.com/gobuffalo/genny/v2" 7 "github.com/gobuffalo/packd" 8 "github.com/gobuffalo/packr/v2" 9 ) 10 11 // ListWalker allows for a box that supports listing and walking 12 type ListWalker interface { 13 packd.Lister 14 packd.Walkable 15 } 16 17 func configs(opts *Options, box ListWalker) genny.RunFn { 18 return func(r *genny.Runner) error { 19 if len(box.List()) == 0 { 20 return nil 21 } 22 return box.Walk(func(p string, f packr.File) error { 23 opts.Out.Header("Buffalo: " + path.Join("config", p)) 24 opts.Out.WriteString(f.String() + "\n") 25 return nil 26 }) 27 } 28 }