internal

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunSettings = &CLISettings{}
View Source
var YutcLog zerolog.Logger

Functions

func BuildTemplate

func BuildTemplate(text string, sharedTemplateBuffers []*bytes.Buffer) (*template.Template, error)

func CheckIfDir added in v0.0.5

func CheckIfDir(path string) (*bool, error)

CheckIfDir checks if a path is a directory, returns a bool pointer and an error if doesn't exist

func GetDataFromPath

func GetDataFromPath(source, arg string) (*bytes.Buffer, error)

GetDataFromPath reads from a file, URL, or stdin and returns a buffer with the contents

func GetDataFromReadCloser

func GetDataFromReadCloser(f io.ReadCloser) (*bytes.Buffer, error)

GetDataFromReadCloser reads from a ReadCloser and returns a buffer with the contents

func GetVersion added in v0.0.5

func GetVersion() string

func InitLogger added in v0.0.3

func InitLogger(levelOverride string)

func IsArchive added in v0.0.5

func IsArchive(filePath string) bool

func LoadSharedTemplates

func LoadSharedTemplates(templates []string) []*bytes.Buffer

func LoadTemplates

func LoadTemplates(templateFiles []string, sharedTemplateBuffers []*bytes.Buffer) ([]*template.Template, error)

func MergeData

func MergeData(dataFiles []string) (map[string]any, error)

func ParseFileStringFlag

func ParseFileStringFlag(v string) (string, error)

func PrintVersion

func PrintVersion()

func ReadTar added in v0.0.5

func ReadTar(filePath string) ([]filePathMap, error)

func ValidateArguments

func ValidateArguments(
	settings *CLISettings,
) int64

ValidateArguments checks the arguments for the CLI and returns a code for the error

func WalkDir added in v0.0.5

func WalkDir(rootPath string, p fs.FS, match []string) []string

Types

type CLISettings added in v0.0.5

type CLISettings struct {
	DataFiles []string `json:"data-files"`
	DataMatch []string `json:"data-match"`

	CommonTemplateFiles []string `json:"common-templates"`
	CommonTemplateMatch []string `json:"common-templates-match"`

	TemplatePaths []string `json:"template-files"`
	TemplateMatch []string `json:"template-match"`

	Output    string `json:"output"`
	Overwrite bool   `json:"overwrite"`

	Version bool `json:"version"`
	Verbose bool `json:"verbose"`

	BearerToken string `json:"bearer-auth"`
	BasicAuth   string `json:"basic-auth"`
}

CLISettings is a struct to hold all the settings from the CLI

Jump to

Keyboard shortcuts

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