expand

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expression

func Expression(expr string, mappingFunc func(string) string) string

Expression will expand the expression specified by expr and will perform parameter expansion on each sub-expression. The mappingFunc is used to lookup variables. If the mappingFunc returns an empty string for a variable the expression will evaluate to the empty string.

func Opportunistic

func Opportunistic(expr string, mappingFunc func(string) string) string

Opportunistic will opportunistically expand the expression specified by expr and will perform parameter expansion on each sub-expression. The mappingFunc is used to lookup variables. If the mappingFunc returns an empty string for a variable then the unmodified input expression is returned.

func Variable

func Variable(variable string, mappingFunc func(string) string) string

Variable will expand the contents of the variable. If the specified variable is immediately followed by [<sep><start>:<end>] then it is split by the sep character, and then the components from start to end are joined. For example, [/2:-1] will remove the first two and last pathname components.

Types

This section is empty.

Jump to

Keyboard shortcuts

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