Documentation
¶
Index ¶
- func ForwardColor(environ []string, colorOn bool) []string
- func Get(t *ast.Task) []string
- func GetEnviron() *ast.Vars
- func GetFromVars(env *ast.Vars) []string
- func GetRiteEnv(key string) string
- func GetRiteEnvBool(key string) (bool, bool)
- func GetRiteEnvDuration(key string) (time.Duration, bool)
- func GetRiteEnvInt(key string) (int, bool)
- func GetRiteEnvString(key string) (string, bool)
- func GetRiteEnvStringSlice(key string) ([]string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForwardColor ¶ added in v1.0.9
ForwardColor appends the de-facto-standard "force color on" env vars (CLICOLOR_FORCE=1 and FORCE_COLOR=1) to the given child environ slice when rite's own color detection has resolved to on (issue #153).
Motivation: when a rite task's `cmds:` spawn a color-aware child (another `rite -l`, `ls`, `rg`, `fd`, ...) the child sees its stdout is a pipe to rite's output machinery and strips color. The outer rite is still writing to a real TTY, so the bytes the child would have emitted are exactly what the user would see. Forwarding the well-known CLICOLOR_FORCE / FORCE_COLOR signals lets modern CLIs opt into color even over pipes.
Honored user overrides (no injection when any of these hold in the parent environ, regardless of colorOn):
- NO_COLOR is set to any non-empty value (no-color.org convention).
- CLICOLOR_FORCE is explicitly set to "0".
- FORCE_COLOR is explicitly set to "0".
The passed-in environ takes precedence when the key is present there; otherwise the process's own os.Environ() is consulted, because execext falls back to os.Environ() when the cmd is spawned with an empty env slice.
NO_COLOR itself is never touched here — it passes through as the user set it and the child can continue to honor it.
func GetEnviron ¶
GetEnviron the all return all environment variables encapsulated on a ast.Vars
func GetFromVars ¶
func GetRiteEnv ¶ added in v1.0.0
GetRiteEnv returns the value of a RITE_-prefixed environment variable. The prefix is applied automatically; callers pass the bare suffix.
func GetRiteEnvBool ¶ added in v1.0.0
GetRiteEnvBool returns the boolean value of a RITE_-prefixed env var. Returns the value and true if set and valid, or false and false if not set or invalid.
func GetRiteEnvDuration ¶ added in v1.0.0
GetRiteEnvDuration returns the duration value of a RITE_-prefixed env var. Returns the value and true if set and valid, or 0 and false if not set or invalid.
func GetRiteEnvInt ¶ added in v1.0.0
GetRiteEnvInt returns the integer value of a RITE_-prefixed env var. Returns the value and true if set and valid, or 0 and false if not set or invalid.
func GetRiteEnvString ¶ added in v1.0.0
GetRiteEnvString returns the string value of a RITE_-prefixed env var. Returns the value and true if set (non-empty), or empty string and false if not set.
func GetRiteEnvStringSlice ¶ added in v1.0.0
GetRiteEnvStringSlice returns a comma-separated list from a RITE_-prefixed env var. Returns the slice and true if set (non-empty), or nil and false if not set.
Types ¶
This section is empty.