Documentation
¶
Index ¶
- func Append(name string, opts ...Option) (*os.File, error)
- func Create(name string, opts ...Option) (*os.File, error)
- func CreateOverwrite(name string) (*os.File, error)
- func DirExists(name string) (bool, error)
- func DirExistsJoin(name ...string) (bool, error)
- func Exists(name string) (bool, error)
- func FileExists(name string) (bool, error)
- func FindFiles(dir string, predicate FindPredicate) ([]string, error)
- func FindFilesNamed(dir, name string) ([]string, error)
- func Mkdir(path string) error
- func MkdirEmpty(path string) error
- func Mkdirs(paths ...string) error
- func Move(oldPath, newPath string, opts ...Option) error
- func SetMtimes(dir string, to time.Time) error
- func WithTempFile(name string, do func(io.Writer) error) (string, error)
- func WriteFile[T Bytes](path string, contents T) error
- func WriteTempFile[T Bytes](name string, contents T) (string, error)
- type Bytes
- type FS
- type FindPredicate
- type Option
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirExistsJoin ¶
DirExistsJoin checks if the dir named by segments exists. Segments is a set of path segments that may or may not themselves contain path separators. The following three calls are all equivalent:
DirExistsJoin("some/long/path") DirExistsJoin("some", "long/path") DirExistsJoin("some", "long", "path")
func FileExists ¶
FileExists returns a boolean indicating that name is a real path and is not a directory.
func FindFiles ¶
func FindFiles(dir string, predicate FindPredicate) ([]string, error)
FindFiles looks for files in the repo, excluding the .git dir.
func FindFilesNamed ¶
FindFilesNamed returns the paths of all files with the specified name in the file tree rooted at dir.
func MkdirEmpty ¶
MkdirEmpty deletes any existing file or directory at path, and then creates a new empty directory at path, using default permissions.
func Mkdirs ¶
Mkdirs calls Mkdir sequentially on paths and returns an error after the first failure.
func Move ¶
Move is like os.Rename except it first ensures there's nothing at dest by deleting anything there.
func WithTempFile ¶
WithTempFile creates a unique temporary file, runs the 'do' function you provide, passing the file as an io.Writer, and then closes the file. It returns the file's path, or an error from 'do', or a general write or close error.