env

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package env provides accessors to the known environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(lookup LookupFunc) (string, bool)

Config returns configuration file path specified via environment variables.

func Theme

func Theme(lookup LookupFunc) (string, bool)

Theme returns theme name specified via environment variables.

func Unset

func Unset()

Unset removes all known environment variables from the current process. Can be useful for unit tests to avoid dependency on environment.

Types

type Color

type Color string

Color is a color setting that can be specified via environment variables.

const (
	ColorAuto   Color = "auto"
	ColorAlways Color = "always"
	ColorNever  Color = "never"
)

Valid values for Color setting.

func ColorSetting

func ColorSetting(lookup LookupFunc) Color

ColorSetting checks environment variables for variables LOGFTXT_COLOR and NO_COLOR.

All command-line software which outputs text with ANSI color added should check for the presence of a NO_COLOR environment variable that, when present (regardless of its value), prevents the addition of ANSI color.

type LookupFunc

type LookupFunc = func(string) (string, bool)

LookupFunc is an environment variable lookup function.

Jump to

Keyboard shortcuts

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