variables

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package variables provides functionality for managing key-value pairs and loading them from files or command-line arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args []string

Args represents a list of key=value strings.

func (Args) ToKeyValues

func (a Args) ToKeyValues() (Variables, error)

ToKeyValues converts the Args into a Variables map, returning any errors encountered.

type Header struct {
	// Values contains predefined variables to use for templating.
	Values Variables `yaml:"values,omitempty"`
	// Exclude indicates whether this file should be excluded from processing.
	Exclude bool `yaml:"exclude,omitempty"`
}

Header represents the header section of an alias file.

func NewHeader

func NewHeader(data []byte) (header Header, err error)

NewHeader parses the header from the given data.

type Values

type Values []string

Values represents a list of value file paths.

func (Values) Variables

func (v Values) Variables() (Variables, error)

Variables loads and merges variables from the specified value files.

type Variables

type Variables map[string]any

Variables represents a set of key-value pairs.

func Defaults

func Defaults(shell, file string) Variables

Defaults returns a set of default variables based on the current environment.

func (*Variables) AppendCwd added in v0.0.21

func (v *Variables) AppendCwd()

AppendCwd appends the current working directory to the variables under the "CWD" key.

func (Variables) Export

func (v Variables) Export() string

Export returns a string representation of the variables, as a comment block.

Jump to

Keyboard shortcuts

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