Documentation ¶
Index ¶
- func CopyDir(src, dst string, dirPerm, filePerm uint32) error
- func CopyEmbeddedDir(src fs.FS, dest string, dirPerm, filePerm uint32) error
- func CopyFile(src, dst string) error
- func CopyFileEx(p *CopyFileT) (err error)
- func CreateOrReplaceSymlink(symlinkPath, target string) error
- func DirExists(path string) bool
- func FileExists(path string) bool
- func GetFileList(path string) ([]string, error)
- func GetSortedFileList(path string, suffix string) ([]string, error)
- func GetSymlinkList(path string) ([]string, error)
- func GetUserConfirmationViaConsole(prompt string) bool
- func ReadTextFile(path string) ([]string, error)
- func ReadTextFileEx(path string) ([]string, string, error)
- func StructToMap(in any) (map[string]any, error)
- func TrimRightSpace(s string) string
- type CopyFileT
- type OverwriteActionT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyEmbeddedDir ¶
CopyEmbeddedDir copies directory from the embedded FS into specified directory
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file.
func CopyFileEx ¶
func CreateOrReplaceSymlink ¶
func FileExists ¶
func GetFileList ¶
GetFileList returns a list of regular files in the specified directory. Sub-directories and symlinks are not included.
func GetSymlinkList ¶
GetSymlinkList returns a list of symlinks in the specified directory. Sub-directories are not included.
func ReadTextFile ¶
func ReadTextFileEx ¶
ReadTextFileEx reads a text file into lines. Trailing (only) whitespace of each line is trimmed. Returns Lines, LineEnding, error.
func StructToMap ¶
StructToMap converts any struct into map[string]any by marshalling it to json and reverse.
func TrimRightSpace ¶
TrimRightSpace trims all trailing whitespace characters. See https://www.danielmorell.com/blog/how-to-trim-whitespace-from-a-string-in-go
Types ¶
type CopyFileT ¶
type CopyFileT struct { Src string Dest string FileMode uint32 // Overwrite bool Overwrite OverwriteActionT // PrependPrefix is a prefix to be prepended to // each line of the file being copied. // Useful to comment out the entire file contents. PrependPrefix string }
type OverwriteActionT ¶
type OverwriteActionT uint32
const ( OverwriteFatal OverwriteActionT = iota OverwriteError OverwriteWarn OverwriteInfo OverwriteSilently )