feat(config): validation on set, refusal to set incorrect values. warns when manually editing with incorrect values

This commit is contained in:
Lewis Wynne 2026-02-12 00:39:41 +00:00
parent 4bd45e7d3c
commit 32459b420b
3 changed files with 36 additions and 1 deletions

View file

@ -145,6 +145,11 @@ func loadConfig() (Config, []string, error) {
return cfg, undecoded, nil
}
// validateConfig checks invariants on a Config value before it is persisted.
func validateConfig(cfg Config) error {
return validListFormat(cfg.List.DefaultListFormat)
}
func configPath() (string, error) {
if override := os.Getenv("PDA_CONFIG"); override != "" {
return filepath.Join(override, "config.toml"), nil