shell

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(path string) bool

func ParseDirectory added in v0.2.0

func ParseDirectory(matches DirMatch, dir string) (isRoot bool, subdirs []string, stopErr error)

ParseDirectory checks if `dir` fits a predicate `matches`. If it encounters an error it cannot proceed from, it returns `stopErr`. Otherwise, it returns all `subdirs` for the parent to recurse into.

func RandLowerChars

func RandLowerChars(length int) string

func Run

func Run(command ...string) (string, error)

Run is a no muss, no fuss way to run a command in a shell. Deprecated: use RunInDir() instead

func RunInDir added in v0.2.0

func RunInDir(directory string, command ...string) (stdoutText string, stderrText string, err error)

RunInDir runs `command` from `directory`, and returns any text from the `command` or `err` that occurred.

func RunInDirWithStdin added in v0.4.0

func RunInDirWithStdin(directory string, input string, command ...string) (stdoutText string, stderrText string, err error)

RunInDirWithStdin runs `command` from `directory`, passing the string `input` to stdin, and returns any text from the `command` or `err` that occurred.

func TempDir

func TempDir() (string, error)

TempDir gets the system temporary directory and makes a random directory underneath that for this probram to use. It may be the developer's responsibility to clean up this directory before the application closes. Consider using cleanup.Defer() in this repository.

Types

type DirMatch added in v0.2.0

type DirMatch func(dir string) (bool, error)

A DirMatch is a predicate to determine whether a given directory (as a string) matches a set of rules

Jump to

Keyboard shortcuts

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