logcolor

package
v1.34.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package logcolor centralises the environment that makes CLI tools emit ANSI colour when lerd runs them with no TTY attached. Workers, UI-run commands and container execs all write to a pipe, a log file or the journal, so tools like artisan, composer, vite and pest disable colour on their own unless told otherwise. The web UI renders the escapes, so we ask for them everywhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environ

func Environ(base []string) []string

Environ appends the colour vars to an existing environment slice.

func PodmanExecArgs

func PodmanExecArgs() []string

PodmanExecArgs returns the flags to add to a `podman exec` invocation.

func PodmanExecTerminalArgs added in v1.32.0

func PodmanExecTerminalArgs(environ []string) []string

PodmanExecTerminalArgs returns TerminalPassthrough as `podman exec` flags.

func QuadletEnvLines

func QuadletEnvLines() string

QuadletEnvLines returns systemd `Environment=` lines for a quadlet or unit body, newline-terminated so callers can splice them into a template.

func ShellExports

func ShellExports() string

ShellExports returns `export KEY=VALUE` lines for a generated guard script.

func TerminalPassthrough added in v1.32.0

func TerminalPassthrough(environ []string) []string

TerminalPassthrough returns the colour environment an attached terminal implies for a container exec. podman forwards none of the host environment, so COLORTERM has to travel explicitly: Symfony Console and laravel/prompts read it first when they pick a colour mode, and without it hex and 256-colour styling is flattened to one of sixteen colours. NO_COLOR and FORCE_COLOR ride along so a choice made on the host holds inside the container, with NO_COLOR winning outright.

TERM is not forwarded. The images carry terminfo for the xterm family only, and Symfony matches TERM against a fixed pattern that foot, wezterm and friends fail, so the host value would turn colour off for exactly the terminals podman's pinned "xterm" keeps working today. A terminal that advertises more than sixteen colours gets xterm-256color instead, an entry every image has, which puts the eight-bit path back in reach as well.

func Vars

func Vars() []string

Vars returns the KEY=VALUE pairs that force colour, or nothing when the user has opted out with NO_COLOR.

Types

This section is empty.

Jump to

Keyboard shortcuts

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