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
Types ¶
type Config ¶
type Config struct {
Repos map[string]Repo `toml:"repos"`
Groups map[string]Group `toml:"-"` // derived from Repos[].Groups, not persisted
// Aliases maps user-defined command names to their expansion in the
// unified command grammar (see internal/cmdspec): "pull --rebase"
// routes per-repo, "git ..."/"jj ..." to that backend, "!..." or
// "sh ..." to the shell.
Aliases map[string]string `toml:"aliases,omitempty"`
Settings Settings `toml:"settings"`
}
Config is the top-level config structure that maps directly to the TOML file.
func Load ¶
Load returns a default config when the file does not exist. The file is created on first write.
func (*Config) AddRepo ¶
AddRepo derives the name 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 updates the groups cache after adding the repo.
func (*Config) RemoveRepo ¶
RemoveRepo scrubs a repo from the config and all groups.
func (*Config) RemoveRepoFromGroup ¶ added in v0.7.0
RemoveRepoFromGroup updates the groups cache after removing the repo.
func (*Config) ResolveScope ¶
ResolveScope resolves explicit CLI names/groups into repo names. Each name may be a repo or a group (with or without the "@" prefix); groups are expanded inline. Duplicates are removed, preserving the order of first appearance. Unknown names are an error.
type Repo ¶
type Repo struct {
// Path is the absolute path to the repository root.
Path string `toml:"path"`
Groups []string `toml:"groups"`
}
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.