v0.1.1 helpers update to public, docs and comments update

This commit is contained in:
2025-11-11 03:48:58 -05:00
parent 00193cf096
commit 7bcd90df3a
14 changed files with 196 additions and 191 deletions

View File

@ -143,7 +143,7 @@ func (c *Config) Save(path string) error {
nestedData := make(map[string]any)
for itemPath, item := range c.items {
setNestedValue(nestedData, itemPath, item.currentValue)
SetNestedValue(nestedData, itemPath, item.currentValue)
}
c.mutex.RUnlock()
@ -215,7 +215,7 @@ func (c *Config) SaveSource(path string, source Source) error {
nestedData := make(map[string]any)
for itemPath, item := range c.items {
if val, exists := item.values[source]; exists {
setNestedValue(nestedData, itemPath, val)
SetNestedValue(nestedData, itemPath, val)
}
}
@ -501,7 +501,7 @@ func (c *Config) loadCLI(args []string) error {
return err // Already wrapped with error category in parseArgs
}
flattenedCLI := flattenMap(parsedCLI, "")
flattenedCLI := FlattenMap(parsedCLI, "")
if len(flattenedCLI) == 0 {
return nil // No CLI args to process.
}
@ -648,13 +648,13 @@ func parseArgs(args []string) (map[string]any, error) {
// Validate keyPath segments
segments := strings.Split(keyPath, ".")
for _, segment := range segments {
if !isValidKeySegment(segment) {
if !IsValidKeySegment(segment) {
return nil, wrapError(ErrInvalidPath, fmt.Errorf("invalid command-line key segment %q in path %q", segment, keyPath))
}
}
// Always store as a string. Let Scan handle final type conversion.
setNestedValue(result, keyPath, valueStr)
SetNestedValue(result, keyPath, valueStr)
}
return result, nil