subst

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 3 Imported by: 10

Documentation

Overview

Package subst does string substituion in build fields.

Index

Constants

This section is empty.

Variables

View Source
var (

	// MaxShortShaLength is the length of the shortsha.
	MaxShortShaLength = 7
)

Functions

func SubstituteBuildFields

func SubstituteBuildFields(b *pb.Build) error

SubstituteBuildFields does an in-place string substitution of build parameters. User-defined substitutions are also accepted. If a built-in substitution value is not defined (perhaps a sourceless build, or storage source), then the corresponding substitutions will result in an empty string.

Types

type TemplateParameter

type TemplateParameter struct {
	Start, End int
	Key        string
	Escape     bool // if true, this parameter is `$$`
}

TemplateParameter represents the position of a Key in a string.

func FindTemplateParameters

func FindTemplateParameters(input string) []*TemplateParameter

FindTemplateParameters finds all the parameters in the string `input`, which are not escaped, and returns an array.

Jump to

Keyboard shortcuts

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