template

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegularFilesOutputTypeYAML = "yaml"
	RegularFilesOutputTypeJSON = "json"
	RegularFilesOutputTypePos  = "pos"
)

When the FileSource are RegularFilesSource, indicates which file format to use when rendering the output.

View Source
const (
	RegularFilesOutputTypeOpenAPI = "openapi-v3"
	RegularFilesOutputTypeNone    = ""
)

When the FileSource are RegularFilesSource, indicates which schema type to use when rendering the output.

Variables

Collections of each category of output type

Functions

func NewCmd

func NewCmd(o *Options) *cobra.Command

Types

type BulkFile

type BulkFile struct {
	Name string `json:"name"`
	Data string `json:"data"`
}

type BulkFiles

type BulkFiles struct {
	Files  []BulkFile `json:"files,omitempty"`
	Errors string     `json:"errors,omitempty"`
}

type BulkFilesSource

type BulkFilesSource struct {
	// contains filtered or unexported fields
}

func NewBulkFilesSource

func NewBulkFilesSource(opts BulkFilesSourceOpts, ui ui.UI) *BulkFilesSource

func (*BulkFilesSource) HasInput

func (s *BulkFilesSource) HasInput() bool

func (*BulkFilesSource) HasOutput

func (s *BulkFilesSource) HasOutput() bool

func (BulkFilesSource) Input

func (s BulkFilesSource) Input() (Input, error)

func (*BulkFilesSource) Output

func (s *BulkFilesSource) Output(out Output) error

type BulkFilesSourceOpts

type BulkFilesSourceOpts struct {
	// contains filtered or unexported fields
}

func (*BulkFilesSourceOpts) Set

func (s *BulkFilesSourceOpts) Set(cmd *cobra.Command)

type DataValuesFile added in v0.34.0

type DataValuesFile struct {
	// contains filtered or unexported fields
}

func NewDataValuesFile added in v0.34.0

func NewDataValuesFile(doc *yamlmeta.Document) DataValuesFile

func (DataValuesFile) AsOverlay added in v0.34.0

func (f DataValuesFile) AsOverlay() (*yamlmeta.Document, error)

type DataValuesFlags added in v0.8.0

type DataValuesFlags struct {
	EnvFromStrings []string
	EnvFromYAML    []string

	KVsFromStrings []string
	KVsFromYAML    []string
	KVsFromFiles   []string

	FromFiles []string

	Inspect       bool
	InspectSchema bool

	EnvironFunc  func() []string
	ReadFileFunc func(string) ([]byte, error)
}

func (*DataValuesFlags) AsOverlays added in v0.26.0

func (s *DataValuesFlags) AsOverlays(strict bool) ([]*datavalues.Envelope, []*datavalues.Envelope, error)

AsOverlays generates Data Values overlays, one for each setting in this DataValuesFlags.

Returns a collection of overlays targeted for the root library and a separate collection of overlays "addressed" to children libraries.

func (*DataValuesFlags) Set added in v0.8.0

func (s *DataValuesFlags) Set(cmd *cobra.Command)

type FileMarksOpts added in v0.25.0

type FileMarksOpts struct {
	FileMarks []string
}

func (*FileMarksOpts) Apply added in v0.25.0

func (s *FileMarksOpts) Apply(filesToProcess []*files.File) ([]*files.File, error)

func (*FileMarksOpts) Set added in v0.25.0

func (s *FileMarksOpts) Set(cmd *cobra.Command)

type FileSource

type FileSource interface {
	HasInput() bool
	HasOutput() bool
	Input() (Input, error)
	// Output renders the results (i.e. an instance of Output) to the configured output/sink of this FileSource
	Output(Output) error
}

FileSource provides both a means of loading from sources (i.e. Input) and rendering into sinks (i.e. Output)

type Input added in v0.32.0

type Input struct {
	Files []*files.File
}

type Options added in v0.32.0

type Options struct {
	IgnoreUnknownComments   bool
	ImplicitMapKeyOverrides bool

	StrictYAML   bool
	Debug        bool
	InspectFiles bool

	BulkFilesSourceOpts    BulkFilesSourceOpts
	RegularFilesSourceOpts RegularFilesSourceOpts
	FileMarksOpts          FileMarksOpts
	DataValuesFlags        DataValuesFlags
}

func NewOptions

func NewOptions() *Options

func (*Options) Run added in v0.32.0

func (o *Options) Run() error

func (*Options) RunWithFiles added in v0.32.0

func (o *Options) RunWithFiles(in Input, ui ui.UI) Output

type Output added in v0.32.0

type Output struct {
	Files  []files.OutputFile
	DocSet *yamlmeta.DocumentSet
	Err    error
}

type OutputType added in v0.38.0

type OutputType struct {
	Types []string
}

OutputType holds the user's desire for two (2) categories of output: - file format type :: yaml, json, pos - schema type :: OpenAPI V3, ytt Schema

func (*OutputType) Format added in v0.38.0

func (o *OutputType) Format() (string, error)

Format returns which of the file format types is in effect

func (*OutputType) Schema added in v0.38.0

func (o *OutputType) Schema() (string, error)

Schema returns which of the schema types is in effect

type RegularFilesSource

type RegularFilesSource struct {
	// contains filtered or unexported fields
}

func NewRegularFilesSource

func NewRegularFilesSource(opts RegularFilesSourceOpts, ui ui.UI) *RegularFilesSource

func (*RegularFilesSource) HasInput

func (s *RegularFilesSource) HasInput() bool

func (*RegularFilesSource) HasOutput

func (s *RegularFilesSource) HasOutput() bool

func (*RegularFilesSource) Input

func (s *RegularFilesSource) Input() (Input, error)

func (*RegularFilesSource) Output

func (s *RegularFilesSource) Output(out Output) error

type RegularFilesSourceOpts

type RegularFilesSourceOpts struct {
	OutputFiles string
	OutputType  OutputType

	files.SymlinkAllowOpts
	// contains filtered or unexported fields
}

RegularFilesSourceOpts holds configuration for when regular files are the input/output of the execution (via the --files and --output... flags).

func (*RegularFilesSourceOpts) Set

func (s *RegularFilesSourceOpts) Set(cmd *cobra.Command)

Set registers flags related to sourcing ordinary files/directories and wires-up those flags up to this RegularFilesSourceOpts to be set when the corresponding cobra.Command is executed.

Jump to

Keyboard shortcuts

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