Movatterモバイル変換


[0]ホーム

URL:


print

package
v0.20.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2025 License:MITImports:6Imported by:3

Details

Repository

github.com/terraform-docs/terraform-docs

Links

Documentation

Overview

Package print provides configuration, and a Generator.

Configuration

`print.Config` is the data structure representation for `.terraform-docs.yml`which will be read and extracted upon execution of terraform-docs cli. On theother hand it can be used directly if you are using terraform-docs as a library.

This will return an instance of `Config` with default values set:

config := print.DefaultConfig()

Alternatively this will return an empty instance of `Config`:

config := print.NewConfig()

Generator

`Generator` is an abstract implementation of `format.Type`. It doesn't implement`Generate(*terraform.Module) error` function. It is used directly by differentformat types, i.e. each format extends `Generator` and provides its implementationof `Generate` function.

Generator holds a reference to all the sections (e.g. header, footer, inputs, etc)and also it renders all of them, in a predefined order, in `Content()`.

It also provides `Render(string)` function to process and render the template to generatethe final output content. Following variables and functions are available:

• `{{ .Header }}`• `{{ .Footer }}`• `{{ .Inputs }}`• `{{ .Modules }}`• `{{ .Outputs }}`• `{{ .Providers }}`• `{{ .Requirements }}`• `{{ .Resources }}`• `{{ include "path/fo/file" }}`

Index

Constants

View Source
const (OutputModeInject  = "inject"OutputModeReplace = "replace")

Output modes.

View Source
const (OutputBeginComment = "<!-- BEGIN_TF_DOCS -->"OutputContent      = "{{ .Content }}"OutputEndComment   = "<!-- END_TF_DOCS -->")

Output template.

View Source
const (SortName     = "name"SortRequired = "required"SortType     = "type")

Sort types.

Variables

Output to file template and modes.

View Source
var AllSections =strings.Join(allSections, ", ")

AllSections list.

View Source
var SortTypes =strings.Join(allSorts, ", ")

SortTypes list.

Functions

This section is empty.

Types

typeConfigadded inv0.16.0

type Config struct {Filestring       `mapstructure:"-"`Formatterstring       `mapstructure:"formatter"`Versionstring       `mapstructure:"version"`HeaderFromstring       `mapstructure:"header-from"`FooterFromstring       `mapstructure:"footer-from"`Recursive    recursive    `mapstructure:"recursive"`Contentstring       `mapstructure:"content"`Sections     sections     `mapstructure:"sections"`Output       output       `mapstructure:"output"`OutputValues outputvalues `mapstructure:"output-values"`Sort         sort         `mapstructure:"sort"`Settings     settings     `mapstructure:"settings"`ModuleRootstring}

Config represents all the available config options that can be accessed andpassed through CLI.

funcDefaultConfigadded inv0.16.0

func DefaultConfig() *Config

DefaultConfig returns new instance of Config with default values set.

funcNewConfigadded inv0.16.0

func NewConfig() *Config

NewConfig returns neew instancee of Config with empty values.

funcReadConfigadded inv0.16.0

func ReadConfig(rootDirstring, filenamestring) (*Config,error)

ReadConfig reads config file in `rootDir` with given `filename` and returnsinstance of Config. It returns error if config file not found or there is aproblem with unmarshalling.

func (*Config)Parseadded inv0.16.0

func (c *Config) Parse()

Parse process config and set sections visibility.

func (*Config)Validateadded inv0.16.0

func (c *Config) Validate()error

Validate provided Config and check for any misuse or misconfiguration.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp