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.
Types ¶
type Config ¶
type Config struct {
Repos map[string]Repo `toml:"repos"`
Groups map[string]Group `toml:"groups"`
Context Context `toml:"context"`
Settings Settings `toml:"settings"`
}
Config is the top-level config structure that maps directly to the TOML file.
func Load ¶
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 ¶
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 ¶
RemoveRepo removes a repo and scrubs it from all groups.
type Context ¶
type Context struct {
// Current is a group name, or empty to mean all repos.
Current string `toml:"current,omitempty"`
}
Context holds the active scope used when no repos/group is specified.
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"`
// Backends holds all detected VCS backends at this path.
// The first element is the active backend.
Backends []string `toml:"backends"`
}
Repo represents a single tracked repository.
func (Repo) ActiveBackend ¶
ActiveBackend returns the first configured backend for this repo. If no backends are configured, returns empty string.