config

package
v0.0.0-...-05574e4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FileName = "ws.toml"
View Source
const LocalFileName = "ws.local.toml"
View Source
const RepoFileName = "ws.repo.toml"

Variables

This section is empty.

Functions

func Discover

func Discover(startDir string) (string, error)

func SaveBoarded

func SaveBoarded(root string, boarded map[string][]string) error

func UpdateLocal

func UpdateLocal(root string, fn func(*LocalConfig)) error

Types

type CapsuleConfig

type CapsuleConfig struct {
	CopyFromGround []string `toml:"copy_from_ground"`
	AfterCreate    string   `toml:"after_create"`
}

type Config

type Config struct {
	Workspace WorkspaceConfig       `toml:"workspace"`
	Repos     map[string]RepoConfig `toml:"repos"`
	Boarded   map[string][]string   `toml:"-"` // from ws.local.toml [boarded] section
	Git       string                `toml:"-"` // from ws.local.toml only
}

func Load

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

func Merge

func Merge(base, local *Config) *Config

Merge returns a new Config with local overrides applied on top of base. Only repos that exist in base are considered; unknown repos in local are skipped. Aliases are appended; AfterCreate, Color, and DisplayName replace if non-empty.

func Parse

func Parse(path string) (*Config, error)

type ConfigDiff

type ConfigDiff struct {
	Added   []string
	Removed []string
}

ConfigDiff describes repos added or removed between two configs.

func Diff

func Diff(old, new *Config) ConfigDiff

Diff compares two configs and returns the repos that were added or removed.

func (ConfigDiff) IsEmpty

func (d ConfigDiff) IsEmpty() bool

IsEmpty returns true if there are no changes.

type LocalConfig

type LocalConfig struct {
	Git     string                `toml:"git"`
	Repos   map[string]RepoConfig `toml:"repos"`
	Boarded map[string][]string   `toml:"boarded"`
}

type RepoConfig

type RepoConfig struct {
	DisplayName string   `toml:"display_name"`
	Aliases     []string `toml:"aliases"`
	Color       string   `toml:"color"`
	AfterCreate string   `toml:"after_create"`
}

type RepoFileConfig

type RepoFileConfig struct {
	Capsule CapsuleConfig `toml:"capsule"`
}

func ParseRepoConfig

func ParseRepoConfig(path string) (*RepoFileConfig, error)

ParseRepoConfig parses a ws.repo.toml file at the given path. Returns nil, nil if the file does not exist.

type WorkspaceConfig

type WorkspaceConfig struct {
	Org           string `toml:"org"`
	DefaultBranch string `toml:"default_branch"`
	DisplayName   string `toml:"display_name"`
}

Jump to

Keyboard shortcuts

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