config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package config provides configuration management functionality

Package config provides configuration UI components

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigChangeListener

type ConfigChangeListener func(key string, oldValue, newValue interface{})

ConfigChangeListener defines a callback for configuration changes

type ConfigSection

type ConfigSection struct {
	Name        string
	Description string
	Settings    []ConfigSetting
}

ConfigSection represents a configuration section for the UI

func (ConfigSection) FilterValue

func (c ConfigSection) FilterValue() string

FilterValue implements list.Item for ConfigSection

type ConfigSetting

type ConfigSetting struct {
	Key         string
	Name        string
	Description string
	Value       interface{}
	Type        string
	Options     []string // For enum-like settings
}

ConfigSetting represents a single configuration setting

func (ConfigSetting) FilterValue

func (c ConfigSetting) FilterValue() string

FilterValue implements list.Item for ConfigSetting

type ConfigSettingDelegate

type ConfigSettingDelegate struct {
	// contains filtered or unexported fields
}

ConfigSettingDelegate is a custom list delegate for configuration settings

func NewConfigSettingDelegate

func NewConfigSettingDelegate(styles configUIStyles) *ConfigSettingDelegate

NewConfigSettingDelegate creates a new configuration setting delegate

func (*ConfigSettingDelegate) Height

func (d *ConfigSettingDelegate) Height() int

Height returns the height of a list item

func (*ConfigSettingDelegate) Render

func (d *ConfigSettingDelegate) Render(w io.Writer, m list.Model, index int, item list.Item)

Render renders a configuration setting with its current value

func (*ConfigSettingDelegate) Spacing

func (d *ConfigSettingDelegate) Spacing() int

Spacing returns the spacing between list items

func (*ConfigSettingDelegate) Update

func (d *ConfigSettingDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd

Update handles updates for the delegate

type ConfigUIModel

type ConfigUIModel struct {
	// contains filtered or unexported fields
}

ConfigUIModel represents the configuration UI model

func NewConfigUIModel

func NewConfigUIModel(manager *Manager) *ConfigUIModel

NewConfigUIModel creates a new configuration UI model

func (*ConfigUIModel) Blur

func (m *ConfigUIModel) Blur()

Blur implements domain.TUIComponent

func (*ConfigUIModel) Focus

func (m *ConfigUIModel) Focus()

Focus implements domain.TUIComponent

func (*ConfigUIModel) Init

func (m *ConfigUIModel) Init() tea.Cmd

Init implements tea.Model

func (*ConfigUIModel) SetSize

func (m *ConfigUIModel) SetSize(width, height int)

SetSize implements domain.TUIComponent

func (*ConfigUIModel) SetTheme

func (m *ConfigUIModel) SetTheme(theme domain.Theme)

SetTheme implements domain.TUIComponent

func (*ConfigUIModel) Update

func (m *ConfigUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model

func (*ConfigUIModel) View

func (m *ConfigUIModel) View() string

View implements tea.Model

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager implements the ConfigurationManager interface

func NewManager

func NewManager() *Manager

NewManager creates a new configuration manager

func (*Manager) AddChangeListener

func (m *Manager) AddChangeListener(listener ConfigChangeListener)

AddChangeListener adds a configuration change listener

func (*Manager) Get

func (m *Manager) Get(key string) interface{}

Get retrieves a configuration value by key

func (*Manager) GetConfig

func (m *Manager) GetConfig() *domain.Config

GetConfig returns the complete configuration

func (*Manager) GetConfigFile

func (m *Manager) GetConfigFile() string

GetConfigFile returns the path of the currently loaded config file

func (*Manager) GetExportConfig

func (m *Manager) GetExportConfig() domain.ExportConfig

GetExportConfig returns the export configuration

func (*Manager) GetLoggingConfig

func (m *Manager) GetLoggingConfig() domain.LoggingConfig

GetLoggingConfig returns the logging configuration

func (*Manager) GetNetworkConfig

func (m *Manager) GetNetworkConfig() domain.NetworkConfig

GetNetworkConfig returns the network configuration

func (*Manager) GetPluginConfig

func (m *Manager) GetPluginConfig() domain.PluginConfig

GetPluginConfig returns the plugin configuration

func (*Manager) GetUIConfig

func (m *Manager) GetUIConfig() domain.UIConfig

GetUIConfig returns the UI configuration

func (*Manager) Load

func (m *Manager) Load() error

Load loads configuration from file and environment variables

func (*Manager) LoadFromFile

func (m *Manager) LoadFromFile(filePath string) error

LoadFromFile loads configuration from a specific file path

func (*Manager) RemoveChangeListener

func (m *Manager) RemoveChangeListener(listener ConfigChangeListener)

RemoveChangeListener removes a configuration change listener

func (*Manager) Reset

func (m *Manager) Reset() error

Reset resets configuration to default values

func (*Manager) ResetSection

func (m *Manager) ResetSection(section string) error

ResetSection resets a specific configuration section to defaults

func (*Manager) Save

func (m *Manager) Save() error

Save saves the current configuration to file

func (*Manager) SaveAs

func (m *Manager) SaveAs(filePath string) error

SaveAs saves the current configuration to a specific file path

func (*Manager) Set

func (m *Manager) Set(key string, value interface{}) error

Set sets a configuration value by key

func (*Manager) SetMultiple

func (m *Manager) SetMultiple(values map[string]interface{}) error

SetMultiple sets multiple configuration values atomically

func (*Manager) Validate

func (m *Manager) Validate() error

Validate validates the current configuration

type ValidationRule

type ValidationRule struct {
	Name     string
	Validate func(interface{}) error
	Message  string
}

ValidationRule represents a single validation rule

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator implements configuration validation

func NewValidator

func NewValidator() *Validator

NewValidator creates a new configuration validator

func (*Validator) Validate

func (v *Validator) Validate(config *domain.Config) error

Validate validates the configuration

func (*Validator) ValidateField

func (v *Validator) ValidateField(key string, value interface{}) error

ValidateField validates a specific configuration field

Jump to

Keyboard shortcuts

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