util

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to a bool

func CreateTar added in v0.4.0

func CreateTar(w io.Writer, root string, paths []string) error

func CreateTarGz

func CreateTarGz(w io.Writer, root string, paths []string) error

func ExpandPaths

func ExpandPaths(workspace string, paths []string) ([]string, error)

ExpandPaths uses a filepath.Match to expand paths according to wildcards. It requires a workspace directory, which is walked and tested for wildcard matches It is used by the dockerfile parser and you most likely want to use ExpandPathsGlob

func ExpandPathsGlob

func ExpandPathsGlob(paths []string) ([]string, error)

ExpandPathsGlob expands paths according to filepath.Glob patterns Returns a list of unique files that match the glob patterns passed in.

func IsSupportedKubernetesFormat

func IsSupportedKubernetesFormat(n string) bool

IsSupportedKubernetesFormat is for determining if a file under a glob pattern is deployable file format. It makes no attempt to check whether or not the file is actually deployable or has the correct contents.

func RandomID

func RandomID() string

func ReadConfiguration added in v0.4.0

func ReadConfiguration(filename string) ([]byte, error)

func RelPathToAbsPath added in v0.4.0

func RelPathToAbsPath(relPaths []string) ([]string, error)

func RunCmd added in v0.6.0

func RunCmd(cmd *exec.Cmd) error

func RunCmdOut added in v0.6.0

func RunCmdOut(cmd *exec.Cmd) ([]byte, error)

func StrSliceContains

func StrSliceContains(sl []string, s string) bool

Types

type Command

type Command interface {
	RunCmdOut(cmd *exec.Cmd) ([]byte, error)
	RunCmd(cmd *exec.Cmd) error
}

Command is an interface used to run commands. All packages should use this interface instead of calling exec.Cmd directly.

var DefaultExecCommand Command = &Commander{}

DefaultExecCommand runs commands using exec.Cmd

type Commander

type Commander struct{}

Commander is the exec.Cmd implementation of the Command interface

func (*Commander) RunCmd added in v0.6.0

func (*Commander) RunCmd(cmd *exec.Cmd) error

RunCmd runs an exec.Command.

func (*Commander) RunCmdOut added in v0.6.0

func (*Commander) RunCmdOut(cmd *exec.Cmd) ([]byte, error)

RunCmdOut runs an exec.Command and returns the stdout and error.

Jump to

Keyboard shortcuts

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