Documentation ¶
Index ¶
- Variables
- func Generate(file File, opts ...Option) error
- func LoadTemplate(pathToTemplate string) (string, error)
- func MustLoadTemplate(pathToTemplate string) string
- func Write(file Document) error
- type Config
- type Data
- type Dir
- type Doc
- type DocWriter
- type Docs
- type Document
- type File
- type Go
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultConfig = Config{ GeneratedHeader: false, Description: "", FileNotice: false, FileNoticeText: "// this was a generated file", RegionTags: false, SkipChildren: true, TemplateExtensionSuffix: defaultTemplateExtension, // contains filtered or unexported fields } )
View Source
var ErrTemplateExtensionEmpty = errors.New("Template extension can not be empty")
Functions ¶
func LoadTemplate ¶
func MustLoadTemplate ¶ added in v0.1.0
Types ¶
type Config ¶
type Config struct { GeneratedHeader bool // Description is documentation written after the generated header and before any template data Description string FileNotice bool // FileNotice is notice written below the package line FileNoticeText string RegionTags bool SkipChildren bool TemplateData interface{} TemplateFuncs template.FuncMap TemplateExtensionSuffix string // contains filtered or unexported fields }
type Dir ¶ added in v0.1.0
type Doc ¶ added in v0.1.0
type Doc struct { // Template is a string of the entire template that // will be parsed and rendered. If it's empty, // the plugin processor will look for .gotpl files // in the same directory of where you wrote the plugin. Template string Bundle string // Filename is the name of the file that will be // written to the system disk once the template is rendered. Filename string Funcs template.FuncMap TemplateData interface{} // contains filtered or unexported fields }
type Docs ¶ added in v0.1.0
type Docs []Document
type Go ¶
type Go struct { // Template is a string of the entire template that // will be parsed and rendered. If it's empty, // the plugin processor will look for .gotpl files // in the same directory of where you wrote the plugin. Template string Bundle string // Filename is the name of the file that will be // written to the system disk once the template is rendered. Filename string Funcs template.FuncMap // PackageName is a helper that specifies the package header declaration. // In other words, when you write the template you don't need to specify `package X` // at the top of the file. By providing PackageName in the Options, the Generate // function will do that for you. PackageName string Imports []string TemplateData interface{} // contains filtered or unexported fields }
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func SetDescription ¶
func SetGlobalFuncMap ¶ added in v0.1.0
func SetGlobalTemplateData ¶ added in v0.1.0
func SetGlobalTemplateData(templateData interface{}) Option
func SetTemplateExtension ¶ added in v0.1.0
func SkipChildren ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
simple/output
file generation is awesome
|
file generation is awesome |
Click to show internal directories.
Click to hide internal directories.