Documentation
¶
Overview ¶
Package envutil provides environment variable helpers with SPROUT_* prefix support.
Index ¶
- func CacheDir() (string, error)
- func ConfigDir() (string, error)
- func DataDir() (string, error)
- func GetConfigDir() (string, error)deprecated
- func GetEnv(suffix string) string
- func GetEnvSimple(suffix string) string
- func HasPrefix(name string) bool
- func LookupEnv(suffix string) (string, bool)
- func ResolveColorPreference(want bool) bool
- func SetEnv(suffix, value string) error
- func StateDir() (string, error)
- func UnsetEnv(suffix string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheDir ¶ added in v0.17.17
CacheDir returns the sprout cache directory path (disposable, regenerable).
Resolution: $SPROUT_CACHE_DIR → $XDG_CACHE_HOME/sprout → $HOME/.cache/sprout.
func ConfigDir ¶ added in v0.17.17
ConfigDir returns the sprout configuration directory path.
Resolution: $SPROUT_CONFIG_DIR → $SPROUT_CONFIG (legacy alias) → $XDG_CONFIG_HOME/sprout → $HOME/.config/sprout.
$SPROUT_CONFIG continues to work as an alias so test isolation and configuration.NewTestManager keep functioning unchanged.
func DataDir ¶ added in v0.17.17
DataDir returns the sprout shared data directory path (regenerable artifacts like embeddings, models).
Resolution: $SPROUT_DATA_DIR → $XDG_DATA_HOME/sprout → $HOME/.local/share/sprout.
func GetConfigDir
deprecated
func GetEnvSimple ¶
GetEnvSimple checks SPROUT_* for a variable name suffix. E.g., GetEnvSimple("CONFIG") checks SPROUT_CONFIG.
func ResolveColorPreference ¶
ResolveColorPreference applies the no-color.org environment overrides to a caller-supplied preference. SP-048-4a.
Precedence (no-color.org-mandated):
- NO_COLOR set to any non-empty value → colors OFF (always wins)
- FORCE_COLOR set to any non-empty value → colors ON (unless NO_COLOR)
- otherwise → caller's want value
Lives in pkg/envutil because pkg/console depends on pkg/configuration (transitively pkg/utils) so pkg/utils can't import pkg/console without creating a cycle. pkg/envutil is the existing zero-dependency leaf used for env-var helpers.
Types ¶
This section is empty.