Documentation ¶
Index ¶
- func BinDirectory(filename string) bool
- func CanRead(filename string) bool
- func DataReadyOnStdin() bool
- func Exists(path string) bool
- func FileHas(path, what string) bool
- func FilterOutBinaryFiles(filenames []string) []string
- func IsBinary(filename string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsFileOrSymlink(path string) bool
- func IsSymlink(path string) bool
- func ReadString(filename string) string
- func Relative(path string) string
- func ShortPath(path string) string
- func TimestampedFilename(filename string) string
- func Which(executable string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinDirectory ¶
BinDirectory will check if the given filename is in one of these directories: /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, ~/.bin, ~/bin, ~/.local/bin
func CanRead ¶ added in v1.1.0
CanRead checks if 1 byte can actually be read from the given filename
func DataReadyOnStdin ¶
func DataReadyOnStdin() bool
DataReadyOnStdin checks if data is ready on stdin
func FilterOutBinaryFiles ¶
FilterOutBinaryFiles filters out files that are either binary or can not be read
func IsBinary ¶ added in v1.4.0
IsBinary returns true if the given filename can be read and is a binary file
func IsFileOrSymlink ¶
IsFileOrSymlink checks if the given path exists and is a regular file or a symbolic link
func ReadString ¶ added in v1.1.0
ReadString returns the contents of the given filename as a string. Returns an empty string if there were errors.
func Relative ¶ added in v1.4.2
Relative takes an absolute or relative path and attempts to return it relative to the current directory. If there are errors, it simply returns the given path.
func ShortPath ¶
ShortPath replaces the home directory with ~ in a given path. The given path is expected to contain the home directory path either 0 or 1 times, and if it contains the path to the home directory, it is expected to be at the start of the given string.
func TimestampedFilename ¶
TimestampedFilename prefixes the given filename with a timestamp
Types ¶
This section is empty.