Documentation ¶
Index ¶
- Constants
- func CheckDir(dirPath string) error
- func CheckDirErrPath(dirPath string, errMsgPath string) error
- func CheckFile(path string) error
- func CheckFileErrPath(path string, errMsgPath string) error
- func Clean(path string) (string, error)
- func CloseSilent(closer io.Closer, closers ...io.Closer)
- func CopyDirOverwrite(src string, dest string, ignoreFns ...IgnoreFn) error
- func CopyFileOverwrite(src string, dest string) error
- func CopyRecursiveShell(src string, dest string) error
- func Create(path string) (*os.File, error)
- func CreateDir(path string) error
- func CreateDirIfMissing(path string) (bool, error)
- func CreateFile(path string) error
- func DeleteDir(path string) error
- func DeleteDirIfPresent(path string) (bool, error)
- func Dir(path string) string
- func DirPathRelativeToCWD(absPath string) string
- func DirPathRelativeToDir(absPath string, dir string) string
- func DirPaths(paths []string, addTrailingSlash bool) []string
- func ErrorCreateDir(path string) error
- func ErrorCreateFile(path string) error
- func ErrorDeleteDir(path string) error
- func ErrorDirDoesNotExist(path string) error
- func ErrorFileAlreadyExists(path string) error
- func ErrorFileDoesNotExist(path string) error
- func ErrorFileSizeLimit(maxFileSizeBytes int64) error
- func ErrorInsufficientMemoryToReadFile(fileSizeBytes, availableMemBytes int64) error
- func ErrorNotADir(path string) error
- func ErrorNotAFile(path string) error
- func ErrorProjectSizeLimit(maxProjectSizeBytes int64) error
- func ErrorReadDir(path string) error
- func ErrorReadFile(path string) error
- func ErrorReadFormFile(fileName string) error
- func ErrorUnexpected() error
- func EscapeTilde(path string) (string, error)
- func FileTree(paths []string, cwd string, dirsOrder DirsOrder) string
- func FilterPathsWithDirPrefix(paths []string, prefix string) []string
- func HashDirectory(dir string, ignoreFns ...IgnoreFn) (string, error)
- func HashFile(path string, paths ...string) (string, error)
- func IgnoreCortexDebug(path string, fi os.FileInfo) (bool, error)
- func IgnoreCortexYAML(path string, fi os.FileInfo) (bool, error)
- func IgnoreHiddenFiles(path string, fi os.FileInfo) (bool, error)
- func IgnoreHiddenFolders(path string, fi os.FileInfo) (bool, error)
- func IgnoreNonPython(path string, fi os.FileInfo) (bool, error)
- func IgnoreNonYAML(path string, fi os.FileInfo) (bool, error)
- func IgnorePythonGeneratedFiles(path string, fi os.FileInfo) (bool, error)
- func IsAbsOrTildePrefixed(path string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsFileOrDir(path string) bool
- func IsFilePathPython(path string) bool
- func IsFilePathYAML(path string) bool
- func ListDir(dir string, relative bool) ([]string, error)
- func ListDirRecursive(dir string, relative bool, ignoreFns ...IgnoreFn) ([]string, error)
- func LongestCommonPath(paths ...string) string
- func MakeEmptyFile(path string) error
- func MakeEmptyFiles(path string, paths ...string) error
- func MakeEmptyFilesInDir(dir string, path string, paths ...string) error
- func Open(path string) (*os.File, error)
- func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)
- func ParentDir(dir string) string
- func PathRelativeToCWD(absPath string) string
- func PathRelativeToDir(absPath string, dir string) string
- func ReadFile(path string) (string, error)
- func ReadFileBytes(path string) ([]byte, error)
- func ReadFileBytesErrPath(path string, errMsgPath string) ([]byte, error)
- func ReadReqFile(r *http.Request, fileName string) ([]byte, error)
- func RelToAbsPath(relativePath string, baseDir string) string
- func ReplacePathWithTilde(absPath string) string
- func SearchForFile(filename string, dir string) (string, error)
- func SortFilePaths(paths []string, dirsOrder DirsOrder) []string
- func TmpDir() (string, error)
- func TrimDirPrefix(fullPath string, dirPath string) string
- func UserRelToAbsPath(relativePath string) string
- func WriteFile(data []byte, path string) error
- func WriteFileFromReader(reader io.Reader, path string) error
- type DirsOrder
- type IgnoreFn
- func ErrorOnBigFilesFn(maxFileSizeBytes int64) IgnoreFn
- func ErrorOnProjectSizeLimit(maxProjectSizeBytes int64) IgnoreFn
- func GitIgnoreFn(gitIgnorePath string) (IgnoreFn, error)
- func IgnoreSpecificFiles(absPaths ...string) IgnoreFn
- func PromptForFilesAboveSize(size int, promptMsgTemplate string) IgnoreFn
Constants ¶
View Source
const ( ErrCreateDir = "files.create_dir" ErrDeleteDir = "files.delete_dir" ErrReadFormFile = "files.read_form_file" ErrCreateFile = "files.create_file" ErrReadDir = "files.read_dir" ErrReadFile = "files.read_file" ErrFileAlreadyExists = "files.file_already_exists" ErrInsufficientMemoryToReadFile = "files.insufficient_memory_to_read_file" ErrFileSizeLimit = "files.file_size_limit" ErrProjectSizeLimit = "files.project_size_limit" ErrUnexpected = "files.unexpected" ErrFileDoesNotExist = "files.file_does_not_exist" ErrDirDoesNotExist = "files.dir_does_not_exist" ErrNotAFile = "files.not_a_file" ErrNotADir = "files.not_a_dir" )
Variables ¶
This section is empty.
Functions ¶
func CheckDirErrPath ¶ added in v0.10.0
CheckDir returns nil if the path is a directory
func CheckFileErrPath ¶ added in v0.10.0
CheckFile returns nil if the path is a file
func Clean ¶ added in v0.20.0
e.g. ~/path/../path2 -> /home/ubuntu/path2 returns without escaping tilde if there was an error
func CopyDirOverwrite ¶ added in v0.16.0
func CopyFileOverwrite ¶ added in v0.16.0
func CopyRecursiveShell ¶ added in v0.16.0
func CreateDirIfMissing ¶
func CreateFile ¶ added in v0.4.0
func DeleteDirIfPresent ¶ added in v0.14.0
func Dir ¶ added in v0.19.0
Return the path to the directory containing the provided path (with a trailing slash)
func DirPathRelativeToCWD ¶ added in v0.13.0
func DirPathRelativeToDir ¶ added in v0.19.0
func ErrorCreateDir ¶ added in v0.4.0
func ErrorCreateFile ¶ added in v0.4.0
func ErrorDeleteDir ¶ added in v0.14.0
func ErrorDirDoesNotExist ¶ added in v0.4.0
func ErrorFileAlreadyExists ¶ added in v0.4.0
func ErrorFileDoesNotExist ¶ added in v0.4.0
func ErrorFileSizeLimit ¶ added in v0.19.0
func ErrorInsufficientMemoryToReadFile ¶ added in v0.19.0
func ErrorNotADir ¶ added in v0.4.0
func ErrorNotAFile ¶ added in v0.4.0
func ErrorProjectSizeLimit ¶ added in v0.19.0
func ErrorReadDir ¶ added in v0.4.0
func ErrorReadFile ¶ added in v0.4.0
func ErrorReadFormFile ¶ added in v0.4.0
func ErrorUnexpected ¶ added in v0.4.0
func ErrorUnexpected() error
func EscapeTilde ¶ added in v0.14.0
e.g. ~/path -> /home/ubuntu/path returns original path if there was an error
func FilterPathsWithDirPrefix ¶ added in v0.24.0
func HashDirectory ¶ added in v0.16.0
func IgnoreCortexDebug ¶ added in v0.12.0
func IgnoreCortexYAML ¶ added in v0.8.0
func IsAbsOrTildePrefixed ¶ added in v0.19.0
func IsFileOrDir ¶
func IsFilePathPython ¶
func IsFilePathYAML ¶
func ListDirRecursive ¶
func LongestCommonPath ¶ added in v0.22.0
Retrieves the longest common path given a list of paths.
func MakeEmptyFile ¶
func MakeEmptyFiles ¶
func PathRelativeToCWD ¶ added in v0.13.0
func PathRelativeToDir ¶ added in v0.19.0
func ReadFileBytes ¶ added in v0.4.0
func ReadFileBytesErrPath ¶ added in v0.10.0
func ReadReqFile ¶
ReadReqFile returns nil if no file
func RelToAbsPath ¶ added in v0.13.0
func ReplacePathWithTilde ¶ added in v0.14.1
e.g. /home/ubuntu/path -> ~/path
func SortFilePaths ¶
func TrimDirPrefix ¶
func UserRelToAbsPath ¶ added in v0.13.0
Types ¶
type DirsOrder ¶
type DirsOrder string
var DirsOnBottom DirsOrder = "bottom"
var DirsOnTop DirsOrder = "top"
var DirsSorted DirsOrder = "sorted"
type IgnoreFn ¶
IgnoreFn if passed a dir, returning true will ignore all subdirs of dir
func ErrorOnBigFilesFn ¶ added in v0.19.0
func ErrorOnProjectSizeLimit ¶ added in v0.19.0
func GitIgnoreFn ¶ added in v0.14.0
func IgnoreSpecificFiles ¶ added in v0.13.0
func PromptForFilesAboveSize ¶ added in v0.13.0
promptMsgTemplate should have two placeholders: the first is for the file path and the second is for the file size
Click to show internal directories.
Click to hide internal directories.