templates

package
v0.0.0-...-899a47e Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package templates defines a uimage template configuration file parser.

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateNotExist = errors.New("config template does not exist")

ErrTemplateNotExist is returned when the given config name did not exist.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Builder is bb, gbb, or binary.
	//
	// Defaults to bb if not given.
	Builder string

	// Commands are commands or template names.
	Commands []string
}

Command represents commands to build.

type Config

type Config struct {
	GOOS      string
	GOARCH    string
	BuildTags []string `yaml:"build_tags"`
	Commands  []Command
	Files     []string
	Init      *string
	Uinit     *string
	Shell     *string
}

Config is a mkuimage build configuration.

type Templates

type Templates struct {
	Configs map[string]Config

	// Commands defines a set of command template name -> commands to expand.
	Commands map[string][]string
}

Templates are a set of mkuimage build configs and command templates.

func Template

func Template() (*Templates, error)

Template parses the first file named .mkuimage.yaml in the current directory or any of its parents.

func TemplateFrom

func TemplateFrom(b []byte) (*Templates, error)

TemplateFrom parses a template from bytes.

func TemplateFromFile

func TemplateFromFile(p string) (*Templates, error)

TemplateFromFile parses a template from the given file.

func (*Templates) CommandsFor

func (t *Templates) CommandsFor(names ...string) []string

CommandsFor expands commands according to command templates.

func (*Templates) Uimage

func (t *Templates) Uimage(config string) ([]uimage.Modifier, error)

Uimage returns the uimage modifiers for the given templated config name.

Jump to

Keyboard shortcuts

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