Documentation ¶
Index ¶
- Variables
- func Capture(log ui.Logger, args ...string) ([]byte, error)
- func CaptureInDir(log ui.Logger, dir string, args ...string) ([]byte, error)
- func Command(log *ui.Task, args ...string) (*exec.Cmd, *bytes.Buffer)
- func Ext(path string) string
- func GlobOne(glob string) (string, error)
- func Hash(values ...interface{}) string
- func RealPath(path string) string
- func RelPathCWD(path string) string
- func RelPathsCWD(paths []string) []string
- func ResolveSymlinks(path string) (links []string, err error)
- func Run(log *ui.Task, args ...string) error
- func RunInDir(log *ui.Task, dir string, args ...string) error
- func Sha256LocalFile(path string) (string, error)
- type CommandRunner
- type FilePatcher
- type RealCommandRunner
Constants ¶
This section is empty.
Variables ¶
var CWD = func() string { dir, err := os.Getwd() if err != nil { panic(err) } return dir + "/" }()
CWD for computing RelPathCWD().
We do this once at init time, but we also make it public so we can update it with flags if necessary.
Functions ¶
func CaptureInDir ¶ added in v0.2.29
CaptureInDir runs a command in the given dir, returning combined stdout and stderr.
func Command ¶
Command constructs a new exec.Cmd with logging configured.
Returns the command, and a *bytes.Buffer containing the combined stdout and stderr of the execution
func Hash ¶
func Hash(values ...interface{}) string
Hash computes a (probably) unique hash of "values".
func RelPathCWD ¶
RelPathCWD returns "path" relative to the current working directory.
func RelPathsCWD ¶
RelPathsCWD returns "paths" relative to the current working directory.
func ResolveSymlinks ¶
ResolveSymlinks returns all symlinks in a chain, including the final file, as absolute paths.
func Sha256LocalFile ¶ added in v0.29.0
Sha256LocalFile Utility function to hash a downloaded file.
Types ¶
type CommandRunner ¶ added in v0.23.2
type CommandRunner interface { // RunInDir runs a command in the given directory. RunInDir(log *ui.Task, dir string, args ...string) error }
CommandRunner abstracts how we run command in a given directory
type FilePatcher ¶
type FilePatcher struct {
// contains filtered or unexported fields
}
FilePatcher is used to update or set lines in a text file, separated by given start and end line markers
func NewFilePatcher ¶
func NewFilePatcher(start, end string) *FilePatcher
NewFilePatcher creates a new FilePatcher
type RealCommandRunner ¶ added in v0.23.2
type RealCommandRunner struct{}
RealCommandRunner actually calls command