Documentation ¶
Index ¶
- func AddCommand(parser *flags.Parser) error
- func ExecValueTemplate(value string, node *brief.Node) (string, error)
- func ExecuteMacro(tmpl *template.Template, section *brief.Node) ([]*brief.Node, error)
- func MakeFolder(names ...string) error
- func MergeBody(node, other *brief.Node)
- func MergeKeys(node, other *brief.Node)
- func MergeNode(node, other *brief.Node)
- func MergeNodes(body []*brief.Node, useNames bool) []*brief.Node
- func ReadNode(specfile string) (*brief.Node, error)
- func ValidateAction(act *brief.Node, pos int) error
- func ValidateFolder(name string) error
- func ValidateTemplate(tmpl *brief.Node, pos int) error
- type Agenda
- type Catalog
- type Command
- func (cmd *Command) CompileSection(section *brief.Node) (*Generator, error)
- func (cmd *Command) Execute(args []string) error
- func (cmd *Command) ExpandProjectMacros(project *brief.Node) error
- func (cmd *Command) Generate(brevity *brief.Node) error
- func (cmd *Command) New() *Generator
- func (cmd *Command) Project(project *brief.Node) error
- func (cmd *Command) ReadSpec() (*brief.Node, error)
- type Dictionary
- type FileSet
- type Generator
- func (gtor *Generator) ApplyActions(spec *brief.Node, dir string) error
- func (gtor *Generator) ApplyTemplates(spec *brief.Node, dir string) error
- func (gtor *Generator) ExecAction(action, spec *brief.Node, dir string) error
- func (gtor *Generator) GenFile(action, spec *brief.Node, dir string) error
- func (gtor *Generator) LoadGenerator(genfile string) error
- func (gtor *Generator) LoadGlobTemplates(fileglob string) error
- func (gtor *Generator) LoadSectionTemplates(section *brief.Node) error
- func (gtor *Generator) NextNode(node *brief.Node, dir string) error
- func (gtor *Generator) SectionNames(section *brief.Node) (map[string]bool, error)
- func (gtor *Generator) ValidateSection(section *brief.Node) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecValueTemplate ¶
ExecValueTemplate for templates inside action key values
func ExecuteMacro ¶
ExecuteMacro template which defines a brief spec then decode into nodes
func MergeNodes ¶
MergeNodes combine a set of nodes of the same Type useNames means they are only merged if they have the same name
func ValidateAction ¶
ValidateAction ensure correct action node
func ValidateFolder ¶
ValidateFolder ensures a folder exists and can be written
Types ¶
type Agenda ¶
type Agenda struct { Templates *Dictionary Actions *Dictionary Found bool }
Agenda contains steps to perform
func (*Agenda) AddTemplate ¶
AddTemplate add template to an agenda
type Command ¶
type Command struct { Args struct { SpecFile string `positional-arg-name:"specfile" description:"brevity specification file"` Destination string `positional-arg-name:"destination" description:"where to put the project root folder"` } `positional-args:"true" required:"true"` Library string `short:"l" long:"lib" description:"Brevity library location" env:"BREVITY_LIB"` Render bool `short:"r" long:"render" description:"Render files without actions"` // contains filtered or unexported fields }
Command for generate
func (*Command) CompileSection ¶
CompileSection within a project Gather
func (*Command) ExpandProjectMacros ¶
ExpandProjectMacros loops over project sections until all macros are expanded
type Dictionary ¶
Dictionary is used to index elements within a section
type FileSet ¶
type FileSet struct { Err error // contains filtered or unexported fields }
FileSet set of files for finding recursion
func (*FileSet) ReverseFiles ¶
ReverseFiles files found in reverse order
type Generator ¶
type Generator struct { Catalog Catalog Template *template.Template Render bool LibDir, SpecDir string }
Generator for code
func (*Generator) ApplyActions ¶
ApplyActions executes actions for this spec node
func (*Generator) ApplyTemplates ¶
ApplyTemplates executes templates for this spec node
func (*Generator) ExecAction ¶
ExecAction executes an action
func (*Generator) LoadGenerator ¶
LoadGenerator if the genfile exists
func (*Generator) LoadGlobTemplates ¶
LoadGlobTemplates loads templates from the fileglob into generator
func (*Generator) LoadSectionTemplates ¶
LoadSectionTemplates load templates for a section
func (*Generator) SectionNames ¶
SectionNames subdirs of the templates directory