Documentation
¶
Index ¶
- func ConfigDir() string
- func ConfigPath() string
- func DefaultCachePath() string
- func DefaultWorkDir() string
- func ExpandTilde(path string) string
- type Config
- func (c *Config) CacheDir() string
- func (c *Config) CacheFile() string
- func (c *Config) DomainFavorites(domain string) []string
- func (c *Config) DomainNames() []string
- func (c *Config) GetDefaultDomain() string
- func (c *Config) RepoPath(domain, org, repo string) string
- func (c *Config) Save() error
- func (c *Config) SaveTo(path string) error
- func (c *Config) ShouldIncludeOrg(org string) bool
- func (c *Config) WorkDirExpanded() string
- type DomainConfig
- type Filters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the directory where the config file lives.
func DefaultCachePath ¶
func DefaultCachePath() string
DefaultCachePath returns the default cache directory path.
func DefaultWorkDir ¶
func DefaultWorkDir() string
DefaultWorkDir returns the default work directory path.
func ExpandTilde ¶
ExpandTilde replaces a leading ~ with the user's home directory.
Types ¶
type Config ¶
type Config struct {
WorkDir string `toml:"work_dir"`
CachePath string `toml:"cache_path"`
Filters Filters `toml:"filters"`
Domains map[string]DomainConfig `toml:"domains"`
}
Config represents the work CLI configuration.
func LoadFrom ¶
LoadFrom reads and parses a config file from the given path. If the file does not exist, returns a Config with default values.
func (*Config) DomainFavorites ¶
DomainFavorites returns the favorite org names for the given domain. Returns nil if the domain is not configured or has no favorites.
func (*Config) DomainNames ¶
DomainNames returns the configured domain hostnames.
func (*Config) GetDefaultDomain ¶
GetDefaultDomain returns the hostname of the domain marked as default, or an empty string if no domain is configured as default.
func (*Config) RepoPath ¶
RepoPath computes the local filesystem path for a repository. Default domain repos omit the domain segment: {work_dir}/{org}/{repo} Non-default domain repos include it: {work_dir}/{domain}/{org}/{repo}
func (*Config) SaveTo ¶
SaveTo writes the config to the given path, creating parent directories as needed. Domain keys containing dots are quoted automatically by the TOML encoder so that [domains."github.com"] stays a single map key rather than being misread as nested tables.
func (*Config) ShouldIncludeOrg ¶
ShouldIncludeOrg determines whether an org passes the global include/exclude filters.
func (*Config) WorkDirExpanded ¶
WorkDirExpanded returns the work directory with ~ expanded to an absolute path.
type DomainConfig ¶
type DomainConfig struct {
IsDefault bool `toml:"is_default"`
FavoriteOrgs []string `toml:"favorite_orgs"`
}
DomainConfig holds settings for a single GitHub domain.
type Filters ¶
type Filters struct {
ExcludeOrgs []string `toml:"exclude_orgs"`
IncludeOrgs []string `toml:"include_orgs"`
}
Filters controls which orgs are included or excluded during cache updates.
func (*Filters) ShouldInclude ¶
ShouldInclude determines whether an org should be included based on filter rules. If include_orgs is non-empty, only orgs in that list pass. Otherwise, orgs in exclude_orgs are rejected and everything else passes.