config

package
v0.0.0-...-09411ad Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config parses downstream.toml.

Index

Constants

View Source
const DefaultPath = "downstream.toml"

Variables

This section is empty.

Functions

func Write

func Write(path string, cfg *Config) error

Write emits the config as downstream.toml. Each dependent's Comment field is written as a "# ..." line above its [[dependents]] header. Encoding is done by hand rather than via toml.Encoder so the comment lines survive and the field order is stable.

func WriteTo

func WriteTo(w io.Writer, cfg *Config) (int64, error)

Types

type Config

type Config struct {
	Package    Package     `toml:"package"`
	Dependents []Dependent `toml:"dependents"`
	// contains filtered or unexported fields
}

func Load

func Load(file string) (*Config, error)

func (*Config) Filter

func (c *Config) Filter(only []string) ([]Dependent, error)

Filter returns the dependents whose name or slug matches one of the given patterns. An empty pattern list returns all dependents. A pattern that matches nothing is an error so typos surface.

type Dependent

type Dependent struct {
	Name         string `toml:"name"`
	Repo         string `toml:"repo"`
	Ref          string `toml:"ref,omitempty"`
	Subdir       string `toml:"subdir,omitempty"`
	Test         string `toml:"test,omitempty"`
	SkipBaseline bool   `toml:"skip_baseline,omitempty"`
	Source       string `toml:"source,omitempty"` // "discover" or "manual"

	// Comment is written as a "# ..." line above the [[dependents]]
	// header. Used by discover to record why a candidate was picked.
	// Not round-tripped; comments are lost on Load.
	Comment string `toml:"-"`
}

func (Dependent) Slug

func (d Dependent) Slug() string

Slug returns a filesystem-safe short name for the dependent, derived from the last two path segments of Name (or Repo).

type Package

type Package struct {
	Name      string `toml:"name"`
	Ecosystem string `toml:"ecosystem"`
	Repo      string `toml:"repo,omitempty"`
	Build     string `toml:"build,omitempty"`
}

Jump to

Keyboard shortcuts

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