config

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFileName is the name of the config file
	ConfigFileName = "config.yaml"

	// DefaultConfigDir is the default directory for lvt configuration
	// This will be ~/.config/lvt/ on Unix systems
	DefaultConfigDir = ".config/lvt"
)
View Source
const (
	// ProjectConfigFileName is the name of the project config file
	ProjectConfigFileName = ".lvtrc"
)

Variables

This section is empty.

Functions

func EnsureConfigDir

func EnsureConfigDir() error

EnsureConfigDir creates the config directory if it doesn't exist using the default manager

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the directory containing the config file using the default manager

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns the path to the config file using the default manager

func SaveConfig

func SaveConfig(config *Config) error

SaveConfig saves the configuration to the config file using the default manager

func SaveProjectConfig

func SaveProjectConfig(basePath string, config *ProjectConfig) error

SaveProjectConfig saves the project configuration to .lvtrc in the specified directory

func SetConfigPath

func SetConfigPath(path string)

SetConfigPath sets a custom config path for the default manager Deprecated: Use Manager.SetCustomPath for better thread safety

Types

type Config

type Config struct {
	// KitPaths are additional paths to search for kits
	// Standard paths (~/.config/lvt/kits/ and .lvt/kits/) are searched automatically
	KitPaths []string `yaml:"kit_paths,omitempty"`

	// Version tracks the config file version for future migrations
	Version string `yaml:"version,omitempty"`
}

Config represents the lvt configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a new Config with default values

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from the config file using the default manager If the file doesn't exist, returns a default config

func LoadConfigFromPath

func LoadConfigFromPath(configPath string) (*Config, error)

LoadConfigFromPath loads configuration from a specific path

func (*Config) AddKitPath

func (c *Config) AddKitPath(path string) error

AddKitPath adds a kit path to the config

func (*Config) RemoveKitPath

func (c *Config) RemoveKitPath(path string) error

RemoveKitPath removes a kit path from the config

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type Manager

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

Manager manages configuration loading and saving with optional custom paths

func NewManager

func NewManager() *Manager

NewManager creates a new configuration manager

func (*Manager) EnsureConfigDir

func (m *Manager) EnsureConfigDir() error

EnsureConfigDir creates the config directory if it doesn't exist

func (*Manager) GetConfigDir

func (m *Manager) GetConfigDir() (string, error)

GetConfigDir returns the directory containing the config file for this manager

func (*Manager) GetConfigPath

func (m *Manager) GetConfigPath() (string, error)

GetConfigPath returns the path to the config file for this manager

func (*Manager) LoadConfig

func (m *Manager) LoadConfig() (*Config, error)

LoadConfig loads the configuration from the config file for this manager If the file doesn't exist, returns a default config

func (*Manager) SaveConfig

func (m *Manager) SaveConfig(config *Config) error

SaveConfig saves the configuration to the config file for this manager

func (*Manager) SetCustomPath

func (m *Manager) SetCustomPath(path string)

SetCustomPath sets a custom config path for this manager instance

type ProjectConfig

type ProjectConfig struct {
	// Module is the Go module name for the project
	Module string

	// Kit is the kit used for this project
	Kit string

	// Styles is the style adapter for components (e.g. "tailwind", "unstyled")
	Styles string

	// DevMode indicates whether to use local client library
	DevMode bool
}

ProjectConfig represents the project-level configuration

func DefaultProjectConfig

func DefaultProjectConfig() *ProjectConfig

DefaultProjectConfig returns a new ProjectConfig with default values

func LoadProjectConfig

func LoadProjectConfig(basePath string) (*ProjectConfig, error)

LoadProjectConfig loads the project configuration from .lvtrc in the specified directory If the file doesn't exist, returns a default config

func (*ProjectConfig) GetKit

func (c *ProjectConfig) GetKit() string

GetKit returns the kit for the project

func (*ProjectConfig) Validate

func (c *ProjectConfig) Validate() error

Validate validates the project configuration

Jump to

Keyboard shortcuts

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