gl

package module
v0.0.0-...-d8f4b3b Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileGlob

func FileGlob(path string) ([]string, error)

func FileLines

func FileLines(path string) []string

func FileRead

func FileRead(path string) string

Reads a file `path` then returns the contents as a string. Always returns a string value. An empty string "" is returned for errors or nonexistent/unreadable files.

func InsertStr

func InsertStr(a []string, b string, i int) []string

Insert string argument #2 into index `i` of first argument `a`.

func IsDir

func IsDir(p string) bool

func IsFile

func IsFile(p string) bool

func PathWalker

func PathWalker(sh *strings.Builder) func(string, fs.DirEntry, error) error

Returns a function for walking a path for files. Files are read and then contents are written to a strings.Builder pointer.

func PipeStr

func PipeStr(prefix string, str string) string

Prefix string `s` with pipes "│". Used to "prettify" command line output. Returns new string.

func StringToFile

func StringToFile(path string, s string) error

Writes the string `s` to the file `path`. It returns any error encountered, nil otherwise.

Types

type RunArg

type RunArg struct {
	Exe     string
	Args    []string
	Dir     string
	Env     []string
	Stdin   []byte
	Timeout int
	Stdout  RunPrinter
	Stderr  RunPrinter
}

func (RunArg) Run

func (a RunArg) Run() (bool, RunOut)

Interface to execute the given `RunArg` through `exec.Command`. The first return value is a boolean, true indicates success, false otherwise. Second value is the standard output of the command. Third value is the standard error of the command. Fourth value is error string from Run.

type RunOut

type RunOut struct {
	Stdout string
	Stderr string
	Error  string
}

type RunPrinter

type RunPrinter func(string)

Directories

Path Synopsis
test module

Jump to

Keyboard shortcuts

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