Documentation
¶
Overview ¶
Package print provides a specific definition of a printer Format
Index ¶
- func CopySections(settings *Settings, src *terraform.Module, dest *terraform.Module)
- func ForEach(callback func(string, GeneratorCallback) error) error
- type Engine
- type GenerateFunc
- func WithContent(content string) GenerateFunc
- func WithFooter(footer string) GenerateFunc
- func WithHeader(header string) GenerateFunc
- func WithInputs(inputs string) GenerateFunc
- func WithModules(modules string) GenerateFunc
- func WithOutputs(outputs string) GenerateFunc
- func WithProviders(providers string) GenerateFunc
- func WithRequirements(requirements string) GenerateFunc
- func WithResources(resources string) GenerateFunc
- type Generator
- type GeneratorCallback
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopySections ¶ added in v0.13.0
CopySections sets the sections that'll be printed
func ForEach ¶ added in v0.14.0
func ForEach(callback func(string, GeneratorCallback) error) error
ForEach section executes GeneratorCallback to render the content for that section and create corresponding GeneratorFunc. If there is any error in the executing the template for the section ForEach function immediately returns it and exit.
Types ¶
type GenerateFunc ¶ added in v0.14.0
type GenerateFunc func(*Generator)
GenerateFunc configures Generator.
func WithContent ¶ added in v0.14.0
func WithContent(content string) GenerateFunc
WithContent specifies how the Generator should add content.
func WithFooter ¶ added in v0.14.0
func WithFooter(footer string) GenerateFunc
WithFooter specifies how the Generator should add Footer.
func WithHeader ¶ added in v0.14.0
func WithHeader(header string) GenerateFunc
WithHeader specifies how the Generator should add Header.
func WithInputs ¶ added in v0.14.0
func WithInputs(inputs string) GenerateFunc
WithInputs specifies how the Generator should add Inputs.
func WithModules ¶ added in v0.14.0
func WithModules(modules string) GenerateFunc
WithModules specifies how the Generator should add Modules.
func WithOutputs ¶ added in v0.14.0
func WithOutputs(outputs string) GenerateFunc
WithOutputs specifies how the Generator should add Outputs.
func WithProviders ¶ added in v0.14.0
func WithProviders(providers string) GenerateFunc
WithProviders specifies how the Generator should add Providers.
func WithRequirements ¶ added in v0.14.0
func WithRequirements(requirements string) GenerateFunc
WithRequirements specifies how the Generator should add Requirements.
func WithResources ¶ added in v0.14.0
func WithResources(resources string) GenerateFunc
WithResources specifies how the Generator should add Resources.
type Generator ¶ added in v0.14.0
type Generator struct { Header string Inputs string Modules string Outputs string Providers string Requirements string Resources string // contains filtered or unexported fields }
Generator represents all the sections that can be generated for a Terraform modules (e.g. header, footer, inputs, etc). All these sections are being generated individually and if no content template was passed they will be combined together with a predefined order.
On the other hand these sections can individually be used in content template to form a custom format (and order).
Note that the notion of custom content template will be ignored for incompatible formatters and custom plugins. Compatible formatters are:
- asciidoc document - asciidoc table - markdown document - markdown table
func NewGenerator ¶ added in v0.14.0
func NewGenerator(name string, fns ...GenerateFunc) *Generator
NewGenerator returns a Generator for specific formatter name and with provided sets of GeneratorFunc functions to build and add individual sections.
func (*Generator) ExecuteTemplate ¶ added in v0.14.0
ExecuteTemplate applies the template with Generator known items. If template is empty Generator.content is returned as is. If template is not empty this still returns Generator.content for incompatible formatters.
type GeneratorCallback ¶ added in v0.14.0
type GeneratorCallback func(string) GenerateFunc
GeneratorCallback renders a Terraform module and creates a GenerateFunc.
type Settings ¶
type Settings struct { // EscapeCharacters escapes special characters (such as _ * in Markdown and > < in JSON) // // default: true // scope: Markdown EscapeCharacters bool // IndentLevel control the indentation of headers [available: 1, 2, 3, 4, 5] // // default: 2 // scope: Asciidoc, Markdown IndentLevel int // OutputValues extract and show Output values from Terraform module output // // default: false // scope: Global OutputValues bool // ShowAnchor show html anchor // // default: true // scope: Asciidoc, Markdown ShowAnchor bool // ShowColor print "colorized" version of result in the terminal // // default: true // scope: Pretty ShowColor bool // ShowDatasources show the data sources on the "Resources" section // // default: true // scope: Global ShowDataSources bool // ShowDefault show "Default" column // // default: true // scope: Asciidoc, Markdown ShowDefault bool // ShowDescription show "Descriptions" as comment on variables // // default: false // scope: tfvars hcl ShowDescription bool // // default: false // scope: Global ShowFooter bool // ShowHeader show "Header" module information // // default: true // scope: Global ShowHeader bool // ShowHTML use HTML tags (a, pre, br, ...) // // default: true // scope: Markdown ShowHTML bool // ShowInputs show "Inputs" information // // default: true // scope: Global ShowInputs bool // ShowModuleCalls show "ModuleCalls" information // // default: true // scope: Global ShowModuleCalls bool // ShowOutputs show "Outputs" information // // default: true // scope: Global ShowOutputs bool // ShowProviders show "Providers" information // // default: true // scope: Global ShowProviders bool // ShowRequired show "Required" column // // default: true // scope: Asciidoc, Markdown ShowRequired bool // ShowSensitivity show "Sensitive" column // // default: true // scope: Asciidoc, Markdown ShowSensitivity bool // ShowRequirements show "Requirements" section // // default: true // scope: Global ShowRequirements bool // ShowResources show "Resources" section // // default: true // scope: Global ShowResources bool // ShowType show "Type" column // // default: true // scope: Asciidoc, Markdown ShowType bool }
Settings represents all settings.
func DefaultSettings ¶
func DefaultSettings() *Settings
DefaultSettings returns new instance of Settings