config

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagDirs      = "dirs"
	TagRm        = "rm"
	TagFiles     = "files"
	TagCmd       = "cmd"
	TagFS        = "fs"
	SettingsHTTP = "settings"
)

Variables

View Source
var (
	ErrCommandEmpty = xerrors.Errorf("command declaration is empty")
)

Functions

This section is empty.

Types

type AddrURL

type AddrURL struct {
	*url.URL `yaml:",inline"`
}

func (*AddrURL) UnmarshalYAML

func (addr *AddrURL) UnmarshalYAML(unmarshal func(any) error) error

type Bytes added in v0.1.5

type Bytes []byte

func (*Bytes) UnmarshalYAML added in v0.1.5

func (fd *Bytes) UnmarshalYAML(node *yaml.Node) error

type Command added in v0.0.9

type Command struct {
	Dir  string   `yaml:"dir"`
	Exec string   `yaml:"exec"`
	Args []string `yaml:"args,flow"`
}

func (*Command) UnmarshalYAML added in v0.0.14

func (c *Command) UnmarshalYAML(unmarshal func(any) error) error

type Config

type Config struct {
	Settings Settings             `yaml:"settings"`
	Dirs     []Section[[]string]  `yaml:"dirs,flow"`
	Rm       []Section[[]string]  `yaml:"rm,flow"`
	Files    []Section[[]File]    `yaml:"files,flow"`
	Cmd      []Section[[]Command] `yaml:"cmd,flow"`
	FS       []Section[[]string]  `yaml:"fs,flow"`
}

func (Config) Validate added in v0.1.6

func (c Config) Validate() error

type File

type File struct {
	Path  string  `yaml:"path"`
	Data  *Bytes  `yaml:"data"`
	Get   *Get    `yaml:"get"`
	Local *string `yaml:"local"`
}

type Get

type Get struct {
	HTTPClientParams `yaml:",inline"`
	URL              string `yaml:"url"`
}

type Group added in v0.1.6

type Group struct {
	Name    string   `yaml:"name"`
	Actions []string `yaml:"actions"`
	Manual  bool     `yaml:"manual"`
}

type Groups added in v0.1.6

type Groups []Group

func (Groups) GroupByAction added in v0.1.6

func (g Groups) GroupByAction() map[string]map[string]struct{}

func (Groups) ManualActions added in v0.1.6

func (g Groups) ManualActions() map[string]struct{}

type HTTPClient added in v0.0.2

type HTTPClient struct {
	HTTPClientParams `yaml:",inline"`
	BaseURL          AddrURL `yaml:"base_url"`
	Debug            bool    `yaml:"debug"`
}

type HTTPClientParams added in v0.0.6

type HTTPClientParams struct {
	Headers     map[string]string `yaml:"headers"`
	QueryParams map[string]string `yaml:"query_params"`
}

type RawPreprocessor added in v0.0.6

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

func NewRawPreprocessor added in v0.0.6

func NewRawPreprocessor(templateName string, templateVars, templateFns map[string]any, templateOptions []string) *RawPreprocessor

func (*RawPreprocessor) Process added in v0.0.6

func (p *RawPreprocessor) Process(data []byte) ([]byte, map[string]any, error)

type Reader added in v0.0.5

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

func NewConfigReader added in v0.0.5

func NewConfigReader(f flag.Flags) *Reader

func (*Reader) Read added in v0.0.5

func (r *Reader) Read() ([]byte, error)

type Script added in v0.1.0

type Script struct {
	Dir    string   `yaml:"dir"`
	Exec   string   `yaml:"exec"`
	Args   []string `yaml:"args,flow"`
	Script string   `yaml:"script,flow"`
}

type Section added in v0.0.3

type Section[T any] struct {
	Line int32
	Tag  string
	Val  T
}

type Settings added in v0.0.6

type Settings struct {
	HTTP   *HTTPClient `yaml:"http"`
	Groups Groups      `yaml:"groups"`
}

type YamlUnmarshaler added in v0.0.6

type YamlUnmarshaler struct{}

func NewYamlConfigUnmarshaler added in v0.0.6

func NewYamlConfigUnmarshaler() *YamlUnmarshaler

func (*YamlUnmarshaler) Unmarshal added in v0.0.6

func (u *YamlUnmarshaler) Unmarshal(rawConfig []byte) (Config, error)

Jump to

Keyboard shortcuts

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