config

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir returns the platform-appropriate config directory for bashcorrect.

func FilePath

func FilePath(override string) (string, error)

FilePath returns the full path to the config file, using override if non-empty.

func Save

func Save(cfg Config) error

Save writes cfg to cfg.Path, creating parent directories as needed.

Types

type AutocorrectConfig

type AutocorrectConfig struct {
	AutoRun  bool `toml:"auto_run"`
	ShowDiff bool `toml:"show_diff"`
}

AutocorrectConfig controls autocorrect behaviour.

type Config

type Config struct {
	ActiveProvider string                    `toml:"active_provider"`
	TriggerPrefix  string                    `toml:"trigger_prefix"`
	Providers      map[string]ProviderConfig `toml:"providers"`
	Autocorrect    AutocorrectConfig         `toml:"autocorrect"`

	// Path is the file this config was loaded from (not persisted).
	Path string `toml:"-"`
}

Config is the top-level config struct.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config pre-populated with sensible defaults.

func Load

func Load(override string) (Config, error)

Load reads the config file at the given path (or the default location). If the file does not exist, it returns the default config.

func (Config) ProviderCfg

func (c Config) ProviderCfg(name string) ProviderConfig

ProviderCfg returns the ProviderConfig for the named provider, or an empty one if not set.

type ProviderConfig

type ProviderConfig struct {
	APIKey string `toml:"api_key"`
	Model  string `toml:"model"`
}

ProviderConfig holds per-provider credentials and model selection.

Jump to

Keyboard shortcuts

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