summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tui/internal/config')
-rw-r--r--packages/tui/internal/config/config.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/packages/tui/internal/config/config.go b/packages/tui/internal/config/config.go
index c9f32a424..ad7b18d07 100644
--- a/packages/tui/internal/config/config.go
+++ b/packages/tui/internal/config/config.go
@@ -17,11 +17,9 @@ type Config struct {
// NewConfig creates a new Config instance with default values.
// This can be useful for initializing a new configuration file.
-func NewConfig(theme, provider, model string) *Config {
+func NewConfig() *Config {
return &Config{
- Theme: theme,
- Provider: provider,
- Model: model,
+ Theme: "opencode",
}
}
@@ -35,12 +33,10 @@ func SaveConfig(filePath string, config *Config) error {
defer file.Close()
writer := bufio.NewWriter(file)
-
encoder := toml.NewEncoder(writer)
if err := encoder.Encode(config); err != nil {
return fmt.Errorf("failed to encode config to TOML file %s: %w", filePath, err)
}
-
if err := writer.Flush(); err != nil {
return fmt.Errorf("failed to flush writer for config file %s: %w", filePath, err)
}
@@ -53,13 +49,11 @@ func SaveConfig(filePath string, config *Config) error {
// It returns a pointer to the Config struct and an error if any issues occur.
func LoadConfig(filePath string) (*Config, error) {
var config Config
-
if _, err := toml.DecodeFile(filePath, &config); err != nil {
if _, statErr := os.Stat(filePath); os.IsNotExist(statErr) {
return nil, fmt.Errorf("config file not found at %s: %w", filePath, statErr)
}
return nil, fmt.Errorf("failed to decode TOML from file %s: %w", filePath, err)
}
-
return &config, nil
}