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

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
type Operation map[string]any
type Pipeline struct {
Pipeline []Operation `yaml:"pipeline"`
}
type BuildOptions struct {
// Excludes lists files and folders to globally exclude from compilation
Excludes []string `yaml:",omitempty"`
}
type Cabretfile struct {
Options BuildOptions
Build []Pipeline
}
func ReadCabretfile(file string) (*Cabretfile, error) {
f, err := os.Open(file)
if err != nil {
return nil, err
}
site := new(Cabretfile)
if err := yaml.NewDecoder(f).Decode(site); err != nil {
return nil, err
}
return site, nil
}