config

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

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

func GetDefaultConfigPath(appName string) (string, error)

GetDefaultConfigPath is updated to take an appName parameter

func ResolveAppConfigPath added in v0.7.0

func ResolveAppConfigPath(appName string, explicit string) (string, error)

ResolveAppConfigPath returns the first existing config file path for the given app. Search order (when explicit == ""):

  1. $XDG_CONFIG_HOME/<appName>/config.yaml (using os.UserConfigDir)
  2. $HOME/.<appName>/config.yaml
  3. /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

type ConfigCommand struct {
	*cobra.Command
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL