specutil

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package spec contains commonly used function for handling spec files

Index

Constants

View Source
const (
	// The spec file is always located in the template root dir and named spec.yaml.
	SpecFileName = "spec.yaml"

	// Keys for output formatting.
	OutputDescriptionKey       = "Description"
	OutputInputNameKey         = "Input name"
	OutputInputDefaultValueKey = "Default"
	OutputInputRuleKey         = "Rule"
)

Variables

This section is empty.

Functions

func AllInputAttrs

func AllInputAttrs(spec *spec.Spec) [][]string

AllInputAttrs describes all spec.Input values in the spec.

func Attrs

func Attrs(spec *spec.Spec) [][]string

Attrs returns a list of human-readable attributes describing a spec, as a list where each entry is a list of columns.

Example:

{
  {"Description", "example description"},
  {"Input Name", "example name"},
}

func FormatAttrs

func FormatAttrs(w io.Writer, attrList [][]string)

FormatAttrs formats the attribute list for output

Example output:

Description: Test Template

Input name: name1 Description: desc1 Default: . Rule 0: test rule 0 Rule 0 msg: test rule 0 message Rule 1: test rule 1

Input name: name2 Description: desc2.

func Load

func Load(ctx context.Context, fs common.FS, templateDir, source string) (*spec.Spec, error)

Load unmarshals the spec.yaml in the given directory.

func OneInputAttrs

func OneInputAttrs(input *spec.Input) [][]string

OneInputAttrs describes a specific spec.Input value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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