config

package
v0.0.0-...-319e03c Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

A Config contains all of the information about how files and packages are installed.

func NewConfig

func NewConfig(in []byte, s EnvSelector) (c Config, err error)

NewConfig creates a config based on the contents of the YAML content `in`, and the Environment `e`. If something goes wrong parsing `in`, err is non-nil.

func (Config) AllDots

func (c Config) AllDots() []string

AllDots returns the slice of all dots that are defined within the config.

func (Config) CheckCmd

func (c Config) CheckCmd() []string

CheckCmd returns the check command that matches the environment. If none of the environments match, nil is returned.

func (Config) DotConfig

func (c Config) DotConfig(dotName string) (d DotConfig)

Get the DotConfig associated with a specific dot. If the dot does not exist in the config, it has all of the globally specified defaults.

func (Config) InstallCmd

func (c Config) InstallCmd() []string

InstallCmd returns the install command that matches the environment. If none of the environments match, nil is returned.

func (Config) Packages

func (c Config) Packages(dotName string) ([]Package, error)

Packages gets a dot `dotName`'s list of packages and their associated expansions as a slice. If the dot specified does not exist, a non-nil error will be the second returned value.

func (Config) ValidateEnv

func (c Config) ValidateEnv() error

ValidateEnv checks the environment string against each validation set in the configuration. It returns non-nil if validation fails.

type DotConfig

type DotConfig struct {
	Method    string
	Root      string
	DotPrefix bool

	Rules  map[string]string
	Deploy [][]string
	// contains filtered or unexported fields
}

A DotConfig holds the most specific settings that can be applied to the installation of dotfiles as specified by a dot configuration in the config. The Rules are set according to the configuration and the environment, and are exclusive to the dot it is a config of. The Method, Root, and DotPrefix are values that can be set in multiple places, with the more specific configurations taking precedence over the more general ones.

From specific to general: environment settings within the dot config, the values of the dot config itself, the environment settings of the global config, the values of the global config itself.

type EnvSelector

type EnvSelector interface {
	Select(keys []string) (key string, fields []string)
	Matches(string) bool
}

type Package

type Package struct {
	Name string
	Desc string
	List []string
}

A Package represents a single key-value pair in the package map of a dot. The Name is the key of a package a dot is using. The Desc is the description of the purpose the specified package serves for the dot. The List is the list of expanded package names if the package is specified in the global package map.

Jump to

Keyboard shortcuts

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