vars

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package vars provides shared regex patterns and utilities for variable expansion.

Index

Constants

This section is empty.

Variables

View Source
var ChainVar = regexp.MustCompile(`\$\{[^}]*\.[^}]+\}|\$[a-zA-Z0-9_\-]+\.[a-zA-Z0-9_\-\.]+`)

ChainVar matches ${step.field} patterns (contains a dot).

View Source
var EnvOnly = regexp.MustCompile(`\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)`)

EnvOnly matches $VAR and ${VAR} patterns without dots (environment variables only). Group 1: contents inside ${...} Group 2: token after $...

View Source
var Expansion = regexp.MustCompile(`\$\{([^}]+)\}|\$([a-zA-Z0-9_\-\.]+)`)

Expansion matches $VAR and ${VAR} patterns, including dots for chain references. Group 1: contents inside ${...} Group 2: token after $...

Functions

func ExpandString

func ExpandString(input string, resolver Resolver) (string, error)

ExpandString replaces all $VAR and ${VAR} occurrences in input using the resolver.

func HasChainVars

func HasChainVars(s string) bool

HasChainVars returns true if the string contains chain variable references (${step.field}).

func HasEnvVars

func HasEnvVars(s string) bool

HasEnvVars returns true if the string contains environment variable references ($VAR or ${VAR}).

Types

type Resolver

type Resolver func(key string) (string, error)

Resolver resolves a variable key to its value.

Jump to

Keyboard shortcuts

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