outputs

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(specs map[string]Spec, inStr string) (map[string]string, error)

Parse uses provided output specifications to extract output values from the provided raw stdout string

**Parameters:**

specs: the specs for the outputs to be extracted inStr: the raw stdout string from the step whose outputs will be extracted

**Returns:**

map[string]string: the output keys and values error: an error if there is a problem

Types

type Filter

type Filter interface {
	Apply(inStr string) (string, error)
}

Filter can be used to extract an output value from the provided string using Apply(...)

type JSONFilter

type JSONFilter struct {
	Path string `yaml:"json_path"`
}

JSONFilter will parse a JSON string and extract the value at the provided path (like jq)

func (*JSONFilter) Apply

func (f *JSONFilter) Apply(inStr string) (string, error)

Apply applies this filters to the target string and produces a new string

type Spec

type Spec struct {
	Filters []Filter `yaml:"filters"`
}

Spec defines an output value for which a given step's stdout should be scanned

func (*Spec) Apply

func (s *Spec) Apply(inStr string) (string, error)

Apply applies all filters in this output spec to the target string in order, producing a new string

func (*Spec) UnmarshalYAML

func (s *Spec) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML is used to load specs from yaml files

Jump to

Keyboard shortcuts

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