config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config handles loading, saving, and querying the hrd configuration file (~/.config/hrd/config.toml by default).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath returns the platform config path for the hrd config file.

func Save

func Save(path string, cfg Config) (err error)

Save writes cfg to path, creating parent directories as needed.

Types

type Config

type Config struct {
	Repos    map[string]Repo  `toml:"repos"`
	Groups   map[string]Group `toml:"-"` // derived from Repos[].Tags, not persisted
	Settings Settings         `toml:"settings"`
}

Config is the top-level config structure that maps directly to the TOML file.

func Load

func Load(path string) (Config, error)

Load reads the config file at path. If the file does not exist a default config is returned without error — the file is created on first write.

func (*Config) AddRepo

func (c *Config) AddRepo(name string, repo Repo)

AddRepo adds or updates a repo entry. The name is derived from the directory base name unless it would conflict, in which case the caller should provide an explicit name.

func (*Config) RemoveRepo

func (c *Config) RemoveRepo(name string)

RemoveRepo removes a repo and scrubs it from all groups.

func (*Config) ResolveScope

func (c *Config) ResolveScope(names []string) ([]string, error)

ResolveScope returns the list of repo names to operate on given an explicit set of names/group passed on the CLI.

func (*Config) TagRepo added in v0.6.0

func (c *Config) TagRepo(name, tag string)

TagRepo adds a tag to a repo and updates the groups cache.

func (*Config) UntagRepo added in v0.6.0

func (c *Config) UntagRepo(name, tag string)

UntagRepo removes a tag from a repo and updates the groups cache.

type Group

type Group struct {
	Repos []string `toml:"repos"`
}

Group is a named collection of repo names.

type Repo

type Repo struct {
	// Path is the absolute path to the repository root.
	Path string   `toml:"path"`
	Tags []string `toml:"tags,omitempty"`
}

Repo represents a single tracked repository.

func (Repo) ActiveBackend

func (r Repo) ActiveBackend() string

ActiveBackend detects and returns the active VCS backend for this repo. Returns empty string if no VCS is detected.

type Settings

type Settings struct {
	// Concurrency caps the number of parallel subprocess invocations.
	Concurrency int `toml:"concurrency"`
}

Settings holds global tunables.

Jump to

Keyboard shortcuts

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