util

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHead added in v0.3.4

func GetHead(path string) (string, error)

GetHead returns the commit ID of the repo located at the given path

func IsDir added in v0.3.4

func IsDir(name string) bool

IsDir returns true if the given path corresponds to a directory

func PackageDir added in v0.3.4

func PackageDir(dir string, ignore []string) ([]byte, error)

PackageDir recursively adds files under the given directory to an in-memory tar file

func Render added in v0.4.2

func Render(name string, values map[string]string, funcs template.FuncMap) ([]byte, error)

Render reads a file and templates it according to the provided functions

Types

type Values

type Values map[string]string

Values represents string mappings for go variables

func (Values) Append

func (v Values) Append(add map[string]string)

Append overrides the current map with a new set of values

func (Values) Cascade

func (v Values) Cascade(current, name, field string) string

Cascade returns the first non empty value

func (Values) FromBytes

func (v Values) FromBytes(data []byte) error

FromBytes reads more key:value mappings from a byte slice

func (Values) FromFile

func (v Values) FromFile(fileName string) error

FromFile reads more key:value mappings from a file

func (Values) FromTemplate

func (v Values) FromTemplate(fileName string, funcs template.FuncMap) error

FromTemplate reads more key:value mappings from a templated file

func (Values) ToSlice

func (v Values) ToSlice() []string

ToSlice converts key:value to key=value

Jump to

Keyboard shortcuts

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