Documentation
¶
Overview ¶
Package envutil provides environment variable helpers with SPROUT_* prefix support.
Index ¶
- func GetConfigDir() (string, error)
- 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 UnsetEnv(suffix string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigDir ¶
GetConfigDir returns the sprout configuration directory path.
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.