v1

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "v1"

Version indicates the version of the 'Spec' struct used to hold 'Hooks' information.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvsMap

type EnvsMap map[string]string

EnvsMap holds the (key, value) pairs associated with a set of environment variables.

func (EnvsMap) Combine

func (e EnvsMap) Combine(e2 EnvsMap) EnvsMap

Combine merges to EnvMaps together Overlapping environment variables from e2 take precedence over those in e.

func (EnvsMap) Format

func (e EnvsMap) Format() []string

Format converts an EnvMap into a list of strings, where each entry is of the form "key=value".

type HookSpec

type HookSpec struct {
	Command string   `json:"command"`
	Args    []string `json:"args"`
	Envs    EnvsMap  `json:"envs"`
	Workdir string   `json:"workdir"`
}

HookSpec holds the actual data associated with a runnable Hook.

func (*HookSpec) Run

func (h *HookSpec) Run(envs EnvsMap, output bool) error

Run executes a specific hook from a HookSpec. It injects the environment variables associated with the provided EnvMap, and optionally prints the output for each hook to stdout and stderr.

type HooksMap

type HooksMap map[string][]HookSpec

HooksMap holds (key, value) pairs mapping a list of HookSpec's to a named hook.

func (HooksMap) Run

func (h HooksMap) Run(name string, envs EnvsMap, output bool) error

Run executes all of the hooks associated with a given name in the HooksMap. It injects the environment variables associated with the provided EnvMap, and optionally prints the output for each hook to stdout and stderr.

type Spec

type Spec struct {
	Version string   `json:"version"`
	Hooks   HooksMap `json:"hooks"`
}

Spec is a versioned struct used to hold 'Hooks' information.

Jump to

Keyboard shortcuts

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