Documentation
¶
Index ¶
- func FormatValue(value interface{}) string
- func GetDefaultConfigPath(appName string) (string, error)
- func ResolveAppConfigPath(appName string, explicit string) (string, error)
- type ConfigCommand
- type ConfigEditor
- func (c *ConfigEditor) Delete(key string) error
- func (c *ConfigEditor) Get(key string) (interface{}, error)
- func (c *ConfigEditor) GetAll() map[string]interface{}
- func (c *ConfigEditor) ListKeys() []string
- func (c *ConfigEditor) Save() error
- func (c *ConfigEditor) Set(key string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatValue ¶
func FormatValue(value interface{}) string
Helper function to format config values for display
func GetDefaultConfigPath ¶
GetDefaultConfigPath is updated to take an appName parameter
func ResolveAppConfigPath ¶ added in v0.7.0
ResolveAppConfigPath returns the first existing config file path for the given app. Search order (when explicit == ""):
- $XDG_CONFIG_HOME/<appName>/config.yaml (using os.UserConfigDir)
- $HOME/.<appName>/config.yaml
- /etc/<appName>/config.yaml
If explicit is provided and exists, it is returned directly. If no candidate exists, returns "" with nil error.
Types ¶
type ConfigCommand ¶
func NewConfigCommand ¶
func NewConfigCommand(appName string) (*ConfigCommand, error)
type ConfigEditor ¶
type ConfigEditor struct {
// contains filtered or unexported fields
}
func NewAppConfigEditor ¶
func NewAppConfigEditor(appName string, configPath string) (*ConfigEditor, error)
NewAppConfigEditor creates a new ConfigEditor for a specific application
func NewConfigEditor ¶
func NewConfigEditor(path string) (*ConfigEditor, error)
NewConfigEditor creates a new ConfigEditor with a specific path
func (*ConfigEditor) Delete ¶
func (c *ConfigEditor) Delete(key string) error
func (*ConfigEditor) Get ¶
func (c *ConfigEditor) Get(key string) (interface{}, error)
func (*ConfigEditor) GetAll ¶
func (c *ConfigEditor) GetAll() map[string]interface{}
func (*ConfigEditor) ListKeys ¶
func (c *ConfigEditor) ListKeys() []string
func (*ConfigEditor) Save ¶
func (c *ConfigEditor) Save() error
func (*ConfigEditor) Set ¶
func (c *ConfigEditor) Set(key string, value interface{}) error
Click to show internal directories.
Click to hide internal directories.