You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
731 B
Go

2 years ago
package config
import (
"os"
"gopkg.in/yaml.v3"
)
// Operation should have at least one key in "source", "use", "target". The remaining keys are options for that operation
2 years ago
type Operation map[string]any
2 years ago
type Pipeline struct {
Pipeline []Operation `yaml:"pipeline"`
2 years ago
}
type BuildOptions struct {
// Excludes lists files and folders to globally exclude from compilation
Excludes []string `yaml:",omitempty"`
2 years ago
}
type Cabretfile struct {
Options BuildOptions
Build []Pipeline
2 years ago
}
func ReadCabretfile(file string) (*Cabretfile, error) {
2 years ago
f, err := os.Open(file)
if err != nil {
return nil, err
}
site := new(Cabretfile)
if err := yaml.NewDecoder(f).Decode(site); err != nil {
2 years ago
return nil, err
}
return site, nil
}