Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Filename = "config.yml"
)

Variables

View Source
var DefaultConfig = Config{
	Debug: false,
}

Functions

func BaseVariables

func BaseVariables() variable.Collection

func Init

func Init() (string, error)

func ParseRoot

func ParseRoot() (*Module, *Override, error)

func Path

func Path() (string, error)

Types

type Config

type Config struct {
	Dir   string `yaml:"-"`
	Path  string `yaml:"-"`
	Debug bool   `yaml:"debug"`
}

type File

type File struct {
	Target            string `yaml:"target"`
	Source            string `yaml:"source"`
	DisableTemplating bool   `yaml:"disable_templating"`
}

type Filters

type Filters struct {
	OperatingSystem []string `yaml:"os"`
	Distribution    []string `yaml:"distro"`
	Architecture    []string `yaml:"arch"`
}

type InnerModule

type InnerModule struct {
	Name      string                 `yaml:"name"`
	Source    string                 `yaml:"source"`
	DependsOn []string               `yaml:"depends_on"`
	Variables map[string]interface{} `yaml:"variables"`
	Filters   Filters                `yaml:"filters"`
}

type Module

type Module struct {
	Name      string        `yaml:"-"`
	Dir       string        `yaml:"-"`
	Path      string        `yaml:"-"`
	Variables []Variable    `yaml:"variables"`
	Files     []File        `yaml:"files"`
	Modules   []InnerModule `yaml:"modules"`
	Scripts   Scripts       `yaml:"scripts"`
}

func Parse

func Parse(path string, variables variable.Collection) (*Module, error)

func (*Module) Validate

func (m *Module) Validate() error

type Override

type Override struct {
	Variables map[string]interface{} `yaml:"variables"`
}

type Script

type Script struct {
	Command string `yaml:"command"`
	Sudo    bool   `yaml:"sudo"`
}

type Scripts

type Scripts struct {
	UpdateRequired  Script `yaml:"should_update"`
	Update          Script `yaml:"update"`
	InstallRequired Script `yaml:"should_install"`
	Install         Script `yaml:"install"`
	AfterFileChange Script `yaml:"after_file_change"`
}

type Variable

type Variable struct {
	Name     string      `yaml:"name"`
	Default  interface{} `yaml:"default"`
	Required bool        `yaml:"required"`
}

func ParseVariables

func ParseVariables(path string) ([]Variable, error)

Jump to

Keyboard shortcuts

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