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:"-"` // derived from Repos[].Groups, not persisted
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) AddRepoToGroup ¶ added in v0.7.0
AddRepoToGroup adds a repo to a group and updates the groups cache.
func (*Config) RemoveRepo ¶
RemoveRepo removes a repo and scrubs it from all groups.
func (*Config) RemoveRepoFromGroup ¶ added in v0.7.0
RemoveRepoFromGroup removes a repo from a group 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"`
Groups []string `toml:"groups,omitempty"`
}
Repo represents a single tracked repository.
func (Repo) ActiveBackend ¶
ActiveBackend detects and returns the active VCS backend for this repo. Returns empty string if no VCS is detected.