fix(config): normalize keys in GetYamlConfig to match SetYamlConfig (#874)
GetYamlConfig was not normalizing key aliases (e.g., sync.branch -> sync-branch), causing 'bd config get sync.branch' to return 'not set' even when the value was correctly stored. SetYamlConfig already normalized keys, but GetYamlConfig did not, leading to a confusing mismatch where set appeared to work but get could not find the value. Added TestGetYamlConfig_KeyNormalization to verify the fix. Fixes #873
This commit is contained in:
@@ -130,11 +130,13 @@ func SetYamlConfig(key, value string) error {
|
||||
|
||||
// GetYamlConfig gets a configuration value from config.yaml.
|
||||
// Returns empty string if key is not found or is commented out.
|
||||
// Keys are normalized to their canonical yaml format (e.g., sync.branch -> sync-branch).
|
||||
func GetYamlConfig(key string) string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
return v.GetString(key)
|
||||
normalizedKey := normalizeYamlKey(key)
|
||||
return v.GetString(normalizedKey)
|
||||
}
|
||||
|
||||
// findProjectConfigYaml finds the project's .beads/config.yaml file.
|
||||
|
||||
Reference in New Issue
Block a user