util

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: ISC Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(fromExec bool, elem ...string) string

AbsPath returns absolute path from current execution path

func AskForStruct

func AskForStruct(target interface{}, tagKey string, ignoreOmitted bool, skipList *[]string, ui cli.Ui) error

AskForStruct reads values from stdin for empty fields of a struct

func ConcatFiles

func ConcatFiles(dest string, append bool, files ...string) error

ConcatFiles concats a set files into a new or existing file

func CreateTempFile

func CreateTempFile(content string) (string, func(), error)

CreateTempFile writes a file in your os temp directory

func DeleteAll

func DeleteAll(basePath string, items ...string) error

DeleteAll deletes all files and directories

func MkDirs

func MkDirs(basePath string, dirs ...string) (func(), error)

MkDirs creates directories

func PipeStdAll

func PipeStdAll() (inR, inW, outR, outW, errR, errW *os.File, restore func(), err error)

PipeStdAll pipes all standard streams temporarily

func PipeStderr

func PipeStderr() (errR, errW *os.File, restore func(), err error)

PipeStderr pipes standard error stream temporarily

func PipeStdin

func PipeStdin() (inR, inW *os.File, restore func(), err error)

PipeStdin pipes standard input stream temporarily

func PipeStdout

func PipeStdout() (outR, outW *os.File, restore func(), err error)

PipeStdout pipes standard output stream temporarily

func PipeStdoutAndStderr

func PipeStdoutAndStderr() (r, w *os.File, restore func(), err error)

PipeStdoutAndStderr pipes standard out and error streams together temporarily

func ReadFromStderrPipe

func ReadFromStderrPipe(errR, errW *os.File, str string) (string, error)

ReadFromStderrPipe reads a written string to stderr through a pipe

func ReadFromStdoutPipe

func ReadFromStdoutPipe(outR, outW *os.File, str string) (string, error)

ReadFromStdoutPipe reads a written string to stdout through a pipe

func ReplaceOSArgs

func ReplaceOSArgs(args []string) func()

ReplaceOSArgs replaces current args with custom args and returns a restore function

func WriteToStdinPipe

func WriteToStdinPipe(inR, inW *os.File, str string) (string, error)

WriteToStdinPipe writes a string to stdin through a pipe

Types

This section is empty.

Jump to

Keyboard shortcuts

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