Documentation ¶
Index ¶
- Variables
- func Capture(log ui.Logger, 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
- type FileLock
- type FilePatcher
- type URL
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 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.
Types ¶
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
FileLock abstracts away the file locking mechanism. One FileLock corresponds to a one file on disk. This does not support multi-threading. Use only from within one go routine.
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 URL ¶
type URL struct {
// contains filtered or unexported fields
}
URL is a builder with convenience methods for manipulating the path component of URLs.
This exists because directly using filepath on a URL string makes it explode.
func (URL) ReplaceExt ¶
ReplaceExt replaces the path file extension with ext.