exprenv

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package exprenv builds and evaluates expr-lang environments for spec expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseFuncs

func BaseFuncs(ptyEnabled bool) map[string]any

BaseFuncs returns the ctx-independent functions injected into every expr-lang environment. ptyEnabled gates the PTY-sensitive rendering functions (pipelineSparkline, statusIcon, prLabelColor).

func EvalExpr

func EvalExpr(env map[string]any, s string) string

EvalExpr evaluates s as an expr-lang expression, returning the result as a string. Returns "" when the expression fails or produces a nil/empty result.

func EvalExprAny

func EvalExprAny(env map[string]any, s string) (any, bool)

EvalExprAny evaluates s as an expr-lang expression and returns the raw result. The bool is false when the expression fails or the result is nil.

func EvalItemsExpr

func EvalItemsExpr(env map[string]any, s string) ([]any, error)

EvalItemsExpr evaluates s as an expr-lang expression expected to return a []any.

func Make

func Make(ctx *cmdctx.Ctx) map[string]any

Make builds the expr-lang environment from ctx. Flags are exposed as a flat map under "flags".

func ResolvePath

func ResolvePath(env map[string]any, path string) (string, error)

ResolvePath evaluates all {{expr}} segments in a path template using the given expr environment, replacing each with its string result.

func WithIt

func WithIt(env map[string]any, val any) map[string]any

WithIt returns a shallow copy of env with "it" set to val.

Types

This section is empty.

Directories

Path Synopsis
Package exprfuncs contains functions injected into the expr-lang environment for use in spec expressions (e.g.
Package exprfuncs contains functions injected into the expr-lang environment for use in spec expressions (e.g.

Jump to

Keyboard shortcuts

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