env

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardColor added in v1.0.9

func ForwardColor(environ []string, colorOn bool) []string

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 Get

func Get(t *ast.Task) []string

func GetEnviron

func GetEnviron() *ast.Vars

GetEnviron the all return all environment variables encapsulated on a ast.Vars

func GetFromVars

func GetFromVars(env *ast.Vars) []string

func GetRiteEnv added in v1.0.0

func GetRiteEnv(key string) string

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

func GetRiteEnvBool(key string) (bool, bool)

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

func GetRiteEnvDuration(key string) (time.Duration, bool)

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

func GetRiteEnvInt(key string) (int, bool)

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

func GetRiteEnvString(key string) (string, bool)

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

func GetRiteEnvStringSlice(key string) ([]string, bool)

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.

Jump to

Keyboard shortcuts

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