Documentation
¶
Overview ¶
Package config reads and writes commit-spark's configuration file (<UserConfigDir>/csp/config.toml).
The file is sparse: only keys the user explicitly set are stored. Load merges the file's values onto a caller-supplied set of defaults, so an absent key falls back to its default (this is how the OS-detected locale flows in). The package performs no OS locale detection itself, keeping it pure and testable.
Index ¶
Constants ¶
const ( TypePlain = "plain" TypeConventional = "conventional" TypeGitmoji = "gitmoji" )
Commit message format types accepted in the config file.
Variables ¶
var Keys = []string{"model", "locale", "type", "timeout", "max-length"}
Keys are the recognized config keys, in display order.
Functions ¶
func DefaultPath ¶
DefaultPath returns <UserConfigDir>/csp/config.toml.
func IsValidKey ¶
IsValidKey reports whether key is a recognized config key.
func ParseType ¶
ParseType validates a commit message type (used for the --type flag). It returns the normalized value or a *apperr.UserError.
func ResolvedValue ¶
ResolvedValue returns the effective value of key as a display string. The second result is false for unrecognized keys.
Types ¶
type Config ¶
Config is the fully resolved, validated configuration used at runtime.
type Duration ¶
Duration wraps time.Duration so it (un)marshals as a duration string such as "60s" or "500ms". A bare TOML integer (e.g. timeout = 60) fails to decode rather than being silently interpreted as nanoseconds.
func (Duration) MarshalText ¶
MarshalText renders the duration in Go's canonical form (e.g. "1m0s").
func (*Duration) UnmarshalText ¶
UnmarshalText parses a duration string via time.ParseDuration.