config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config resolves gskill's layered configuration. Precedence, lowest to highest, is: built-in defaults, user config file, project config file, GSKILL_-prefixed environment variables, then explicit flags. Storage paths follow the platform convention (XDG on Linux, the OS equivalents elsewhere) and may be overridden with GSKILL_CONFIG_DIR / GSKILL_CACHE_DIR.

Index

Constants

View Source
const (
	// EnvPrefix is the prefix for environment-variable overrides.
	EnvPrefix = "GSKILL_"
)

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() (string, error)

CacheDir returns the gskill cache directory, honoring GSKILL_CACHE_DIR and otherwise following the platform convention.

func DefaultMap

func DefaultMap() map[string]any

DefaultMap returns the built-in configuration defaults.

func Dir

func Dir() (string, error)

Dir returns the gskill configuration directory, honoring GSKILL_CONFIG_DIR and otherwise following the platform convention.

Types

type Config

type Config struct {
	LogLevel  string
	LogFormat string
	Offline   bool
	NoCache   bool
	Jobs      int
	// Repositories are the known skill repositories an unscoped `find` searches
	// (FR-038). Configured in a config file (TOML array) or via
	// GSKILL_REPOSITORIES (comma-separated).
	Repositories []string
}

Config is the resolved, layered gskill configuration.

func Load

func Load(s Sources) (*Config, error)

Load merges the configuration layers in Sources and returns the result.

type Sources

type Sources struct {
	// Defaults seeds the lowest layer. When nil, DefaultMap is used.
	Defaults map[string]any
	// UserFile and ProjectFile are optional TOML config paths. A missing file
	// is skipped without error.
	UserFile    string
	ProjectFile string
	// Environ is a list of "KEY=VALUE" entries (as from os.Environ); only
	// GSKILL_-prefixed entries are consulted. When nil, the process environment
	// is used.
	Environ []string
	// Flags is the highest-precedence layer of explicitly set flag values.
	Flags map[string]any
}

Sources are the inputs to Load. Empty fields are skipped; later layers override earlier ones in the documented precedence order.

Jump to

Keyboard shortcuts

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