config

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuilderVar

type BuilderVar struct {
	Name          string            `yaml:"name"`
	Default       BuilderVarDefault `yaml:"default"`
	Description   string            `yaml:"description"`
	ExampleValues []string          `yaml:"exampleValues"`
	Type          string            `yaml:"type"`
	Value         string            `yaml:"value"`
	Versions      string            `yaml:"versions"`
}

type BuilderVarDefault

type BuilderVarDefault struct {
	IsPromptDisabled bool   `yaml:"disablePrompt"`
	ReferenceVar     string `yaml:"referenceVar"`
	Value            string `yaml:"value"`
}

type DraftConfig

type DraftConfig struct {
	TemplateName        string            `yaml:"template"`
	DisplayName         string            `yaml:"displayName"`
	Variables           []*BuilderVar     `yaml:"variables"`
	FileNameOverrideMap map[string]string `yaml:"filenameOverrideMap"`
	Versions            string            `yaml:"versions"`
	DefaultVersion      string            `yaml:"defaultVersion"`
}

func NewConfigFromFS

func NewConfigFromFS(fileSys fs.FS, path string) (*DraftConfig, error)

func (*DraftConfig) ApplyDefaultVariables

func (d *DraftConfig) ApplyDefaultVariables() error

ApplyDefaultVariables will apply the defaults to variables that are not already set

func (*DraftConfig) ApplyDefaultVariablesForVersion

func (d *DraftConfig) ApplyDefaultVariablesForVersion(version string) error

ApplyDefaultVariablesForVersion will apply the defaults to variables that are not already set

func (*DraftConfig) GetVariable

func (d *DraftConfig) GetVariable(name string) (*BuilderVar, error)

func (*DraftConfig) GetVariableExampleValues

func (d *DraftConfig) GetVariableExampleValues() map[string][]string

func (*DraftConfig) GetVariableMap

func (d *DraftConfig) GetVariableMap() map[string]string

Returns a map of variable names to values used in Gotemplate

func (*DraftConfig) GetVariableValue

func (d *DraftConfig) GetVariableValue(name string) (string, error)

func (*DraftConfig) SetVariable

func (d *DraftConfig) SetVariable(name, value string)

func (*DraftConfig) VariableMapToDraftConfig

func (d *DraftConfig) VariableMapToDraftConfig(flagVariablesMap map[string]string)

handles flags that are meant to represent template variables

type TemplateVariableRecorder

type TemplateVariableRecorder interface {
	Record(key, value string)
}

TemplateVariableRecorder is an interface for recording variables that are read using draft configs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL