Files
vault-tui/internal/config/color.go
T
f.weber ae30ba1240 feat(vault-tui): implement KV client and service for managing secrets
- Added internal/vault/client.go for creating a Vault client with configuration settings.
- Introduced internal/vault/errors.go to classify Vault API errors for better UI handling.
- Created internal/vault/kv.go to manage KV secrets, including listing, reading, writing, and deleting operations.
- Implemented internal/vault/mounts.go to list and describe secret engine mounts.
- Developed internal/vault/service.go to provide a unified entry point for Vault operations.
- Added internal/vault/kv_test.go for comprehensive testing of KV operations.
- Introduced internal/ui/toast.go for transient notifications in the UI.
- Added renovate.json for dependency management and updates.
2026-08-14 11:09:03 +02:00

41 lines
886 B
Go

package config
import (
"fmt"
"gopkg.in/yaml.v3"
)
// UnmarshalYAML accepts either a scalar ("#7D56F4") applied to both
// appearances, or a mapping ({light: "#...", dark: "#..."}).
func (c *Color) UnmarshalYAML(n *yaml.Node) error {
switch n.Kind {
case yaml.ScalarNode:
var s string
if err := n.Decode(&s); err != nil {
return err
}
c.Light, c.Dark = s, s
return nil
case yaml.MappingNode:
var pair struct {
Light string `yaml:"light"`
Dark string `yaml:"dark"`
}
if err := n.Decode(&pair); err != nil {
return err
}
c.Light, c.Dark = pair.Light, pair.Dark
return nil
default:
return fmt.Errorf("color must be a string or a {light, dark} mapping, got %v", n.Kind)
}
}
func (c Color) MarshalYAML() (interface{}, error) {
if c.Light == c.Dark {
return c.Light, nil
}
return map[string]string{"light": c.Light, "dark": c.Dark}, nil
}