Documentation
¶
Index ¶
- func ChimeError(err interface{})
- func ChimeErrorf(format string, args ...interface{})
- func ContainsFrontMatter(r *bufio.Reader) (bool, error)
- func CopyFile(srcPath string, destPath string) error
- func CreateEmptyFiles(paths []string) error
- func CreateFileWithPath(path string) (*os.File, error)
- func Recovery(fullStackTrace bool)
- func RecursiveCopy(srcDir string, destDir string) error
- func RemoveAllIfExists(path string) error
- func RemoveEmptyDirs(path string) error
- func RemoveIfExists(path string) error
- func SplitFrontMatter(r *bufio.Reader) (frontMatter string, content string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChimeError ¶
func ChimeError(err interface{})
ChimeError outputs the bell character and then the error message, colored red and formatted.
func ChimeErrorf ¶
func ChimeErrorf(format string, args ...interface{})
ChimeErrorf outputs the bell character and then the error message, colored red and formatted according to format and args. It works just like fmt.Printf.
func ContainsFrontMatter ¶
ContainsFrontMatter returns true iff the contents of r include frontmatter. It checks the first couple of bytes to see if they equal the front matter delimiter without changing the position of r.
func CopyFile ¶
CopyFile copies the file at srcePath to destPath. It creates any directories needed for destPath.
func CreateEmptyFiles ¶
CreateEmptyFiles creates new, empty files for every path in paths. It does not write to them, and any old content that may have been there is erased.
func CreateFileWithPath ¶
CreateFileWithPath creates a file by first creating the directory the file will be placed in with os.MkdirAll (analogous to mkdir -p), and then creating the file itself. If the file already exists, it will overwrite the existing file. If there were any other problems creating the file, it will return an error.
func Recovery ¶
func Recovery(fullStackTrace bool)
Recovery can be used to catch panics and turn them into errors. Recovery will not halt the program, though it does not guarantee that the program won't be halted for other reasons.
func RecursiveCopy ¶
RecursiveCopy copies everything from srcDir to destDir recursively. It is analogous to cp -R in unix systems.
func RemoveAllIfExists ¶
RemoveAllIfExists removes the directory identified by path if it exists. If it does not exist, calling this function has no effect. Contrary to the default behavior in the os package, RemoveAllIfExists will not return an error if path does not exist.
func RemoveEmptyDirs ¶
RemoveEmptyDirs recursively iterates through path and removes any empty directories within it.
func RemoveIfExists ¶
RemoveIfExists removes the file identified by path if it exists. If it does not exist, calling this function has no effect. Contrary to the default behavior in the os package, RemoveIfExists will not return an error if path does not exist.
Types ¶
This section is empty.