core

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigVersion = 2

ConfigVersion is the current config schema version. Increment this when making breaking changes to the config format and add a corresponding migration note in the migrations package.

View Source
const EnvPrefix = "MMDOT_"

Variables

This section is empty.

Functions

func ParseOctalPermissions added in v0.4.0

func ParseOctalPermissions(s string) (os.FileMode, error)

ParseOctalPermissions parses an octal permission string (e.g. "0600") into an os.FileMode.

Types

type Age added in v0.2.0

type Age struct {
	Recipients   []string  `yaml:"recipients"`
	IdentityFile string    `yaml:"identity_file"`
	Files        []AgeFile `yaml:"files"`
}

func (Age) ReadIdentity added in v0.2.0

func (a Age) ReadIdentity() (age.Identity, error)

type AgeFile added in v0.4.0

type AgeFile struct {
	Src         string `yaml:"src"`
	Dest        string `yaml:"dest"`
	Permissions string `yaml:"perm"`
}

func (AgeFile) Validate added in v0.4.0

func (af AgeFile) Validate() error

type Brews added in v0.2.0

type Brews struct {
	Remove   bool     `yaml:"remove"`
	Includes []string `yaml:"includes"`
	Brews    []string `yaml:"brews"`
	Taps     []string `yaml:"taps"`
	Casks    []string `yaml:"casks"`
	MAS      []string `yaml:"mas"`
}

func (*Brews) Diff added in v0.2.0

func (c *Brews) Diff() (*DiffResult, error)

Diff returns a comparison between the brews in the Config and those installed on the machine. It categorizes brews into: - Present: Items in config and installed on the machine - Absent: Items in config but not installed on the machine - Extra: Items installed on the machine but not in the config (drift detection)

type ConfigFile added in v0.2.0

type ConfigFile struct {
	Version   int               `yaml:"version"`
	Macros    map[string]string `yaml:"macros"`
	Exec      Exec              `yaml:"exec"`
	Age       Age               `yaml:"age"`
	Brews     ConfigMap         `yaml:"brews"`
	Variables Variables         `yaml:"variables"`
	Templates []Template        `yaml:"templates"`
	ConfigDir string            `yaml:"-"` // Directory containing the config file (not serialized)
}

func SetupEnv added in v0.2.0

func SetupEnv(cfgpath string) (ConfigFile, error)

func (ConfigFile) EncryptedFiles added in v0.2.0

func (c ConfigFile) EncryptedFiles() []string

Returns a list of all files that should to be encrypted

type ConfigMap added in v0.2.0

type ConfigMap map[string]*Brews

func (ConfigMap) Get added in v0.2.0

func (cm ConfigMap) Get(key string) *Brews

type DiffResult added in v0.2.0

type DiffResult struct {
	Present []string // Present on machine
	Absent  []string // Absent from machine
	Extra   []string // Present in config, Absent from machine
}

type Exec added in v0.2.0

type Exec struct {
	Shell   string   `yaml:"shell"`
	Scripts []Script `yaml:"scripts"`
}

ExecConfig represents the shell execution configuration

type Flags

type Flags struct {
	LogLevel       string
	ConfigFilePath string
}

type PathResolver added in v0.2.0

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

PathResolver provides a resolving service for paths that turns a relative or paths with '~' type symbols into absolute paths.

func (PathResolver) Resolve added in v0.2.0

func (pr PathResolver) Resolve(ip string) (string, error)

type Script added in v0.2.0

type Script struct {
	Path string   `yaml:"path"`
	Tags []string `yaml:"tags"`
}

Script represents a single executable script with associated tags

type Template added in v0.2.0

type Template struct {
	Name        string         `yaml:"name"`
	Tags        []string       `yaml:"tags"`
	Template    string         `yaml:"template"` // File or Template
	Output      string         `yaml:"output"`
	Permissions string         `yaml:"perm"` // Must be valid permissions
	Vars        map[string]any `yaml:"vars"`
	Trim        *bool          `yaml:"trim"` // Trim leading/trailing whitespace from output (default: true)
}

func (Template) ShouldTrim added in v0.2.0

func (t Template) ShouldTrim() bool

type VarFile added in v0.2.0

type VarFile struct {
	Path    string
	IsVault bool
}

func (*VarFile) UnmarshalYAML added in v0.2.0

func (vf *VarFile) UnmarshalYAML(unmarshal func(any) error) error

type Variables added in v0.2.0

type Variables struct {
	VarFiles []VarFile      `yaml:"var_files"`
	Vars     map[string]any `yaml:"vars"`
}

Jump to

Keyboard shortcuts

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