utils

package
v0.0.12-beta Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountYamlListItems added in v0.0.11

func CountYamlListItems(data []byte) (int, error)

CountYamlListItems counts the number of items in a YAML list.

func GetInherits added in v0.0.11

func GetInherits(data []byte, defaultInherit string, length int) ([]inherit.Inherit, error)

func LoadDotEnv

func LoadDotEnv(path file.File) error

LoadFromDotEnv loads environment variables from a .env file.

func LoadTools

func LoadTools(path file.File, defaults *defaults.Defaults, defaultConfig string) (tools.Tools, error)

LoadTools loads the tools configuration from the specified file path, or from stdin if the path is "-". It returns a Tools collection, initialized with the provided defaults.

func ParseBytes added in v0.0.11

func ParseBytes(yamlBytes []byte) any

ParseBytes parses YAML bytes into a generic data structure.

func Print

func Print(format string, cfg ...any)

Print displays the configuration in the specified format.

func SplitTags

func SplitTags(tagList []string) tags.IncludeTags

Split splits tags into include and exclude lists.

Types

type Inherits added in v0.0.11

type Inherits struct {
	Inherit string
}

func (*Inherits) UnmarshalYAML added in v0.0.11

func (i *Inherits) UnmarshalYAML(value *yaml.Node) error

type ToolsLoader

type ToolsLoader struct {
	// File represents the file path to the tools configuration.
	File file.File
	// Defaults represents the default tool configuration.
	Defaults *defaults.Defaults
	// contains filtered or unexported fields
}

ToolsLoader is a struct that handles loading tools configuration.

func (*ToolsLoader) Length added in v0.0.11

func (t *ToolsLoader) Length() int

func (*ToolsLoader) Load added in v0.0.11

func (t *ToolsLoader) Load(defaultConfig string) error

LoadTools loads the tools configuration.

func (*ToolsLoader) Read added in v0.0.11

func (t *ToolsLoader) Read() (data []byte, err error)

Read reads a tool configuration file and loads it into the a Tools collection. If the path is "-", it reads from stdin. Else, it reads from the specified file path.

func (*ToolsLoader) Type added in v0.0.11

func (t *ToolsLoader) Type() (Type, error)

Type returns the type of tool configuration source.

func (*ToolsLoader) UnmarshalPieceByPiece added in v0.0.11

func (t *ToolsLoader) UnmarshalPieceByPiece(data []byte) (err error)

UnmarshalPieceByPiece unmarshals the YAML list-item by list-item.

func (*ToolsLoader) UnmarshalWhole added in v0.0.11

func (t *ToolsLoader) UnmarshalWhole(data []byte) (err error)

UnmarshalWhole unmarshals the entire YAML configuration into the tools collection.

type Type added in v0.0.11

type Type int

Type represents the type of tool configuration source.

const (
	// File represents a file path.
	FILE Type = iota
	// Stdin represents standard input.
	STDIN
)

Jump to

Keyboard shortcuts

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