Documentation
¶
Index ¶
- func EnsureDir(dir string) (err error)
- func EnsureDirEnh(dir string) (err error)
- func FileExists(name string) bool
- func ForDir(root string, ...) (err error)
- func ForDirMax(root string, initialDepth, maxDepth int, ...) (err error)
- func GetCurrentDir() string
- func GetExecutableDir() string
- func GetExecutablePath() string
- func IsDirectory(path string) (bool, error)
- func IsEAccess(err error) bool
- func IsExecAll(mode os.FileMode) bool
- func IsExecAny(mode os.FileMode) bool
- func IsExecGroup(mode os.FileMode) bool
- func IsExecOther(mode os.FileMode) bool
- func IsExecOwner(mode os.FileMode) bool
- func IsExitError(err error) (int, bool)
- func IsRegularFile(path string) (bool, error)
- func NormalizeDir(s string) string
- func RemoveDirRecursive(dir string) (err error)
- func Run(command string, arguments ...string) error
- func RunCommand(command string, readStdout bool, arguments ...string) (retCode int, stdoutText string, err error)
- func RunWithOutput(command string, arguments ...string) (int, string, error)
- func Sudo(command string, arguments ...string) (int, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDirEnh ¶
EnsureDirEnh checks and creates the directory, via sudo if necessary.
func FileExists ¶
FileExists returns the existence of an directory or file
func ForDir ¶ added in v0.1.18
func ForDir(root string, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)
ForDir walks on `root` directory and its children
func ForDirMax ¶ added in v0.1.18
func ForDirMax(root string, initialDepth, maxDepth int, cb func(depth int, cwd string, fi os.FileInfo) (stop bool, err error)) (err error)
ForDirMax walks on `root` directory and its children with nested levels up to `maxLength`.
Example - discover folder just one level
_ = ForDirMax(dir, 0, 1, func(depth int, cwd string, fi os.FileInfo) (stop bool, err error) {
if fi.IsDir() {
return
}
// ... doing something for a file,
return
})
func GetCurrentDir ¶
func GetCurrentDir() string
GetCurrentDir returns the current workingFlag directory it should be equal with os.Getenv("PWD")
func GetExecutableDir ¶
func GetExecutableDir() string
GetExecutableDir returns the executable file directory
func GetExecutablePath ¶ added in v0.1.16
func GetExecutablePath() string
GetExecutablePath returns the executable file path
func IsDirectory ¶
IsDirectory tests whether `path` is a directory or not
func IsExecAll ¶ added in v0.1.18
IsExecAll give the result of whether a file can be invoked by all users
func IsExecAny ¶ added in v0.1.18
IsExecAny give the result of whether a file can be invoked by anyone
func IsExecGroup ¶ added in v0.1.18
IsExecGroup give the result of whether a file can be invoked by its unix-group
func IsExecOther ¶ added in v0.1.18
IsExecOther give the result of whether a file can be invoked by its unix-all
func IsExecOwner ¶ added in v0.1.18
IsExecOwner give the result of whether a file can be invoked by its unix-owner
func IsRegularFile ¶
IsRegularFile tests whether `path` is a normal regular file or not
func RemoveDirRecursive ¶
RemoveDirRecursive removes a directory and any children it contains.
func RunCommand ¶
func RunCommand(command string, readStdout bool, arguments ...string) (retCode int, stdoutText string, err error)
RunCommand runs an OS command
func RunWithOutput ¶
RunWithOutput runs an OS command and collect the result outputting
Types ¶
This section is empty.