A package of common utilities for command execution, input, and IO.
coreutils is licensed under Apache-2.0
import "github.com/StroblIndustries/coreutils"var GlobalFileMode os.FileModeGlobalFileMode is a file mode we'll use for global IO operations.
var NonGlobalFileMode os.FileModeNonGlobalFileMode is the file mode we'll use for non-global IO operations.
func AbsPath(path string) stringAbsPath get the absolute directory path, cleaning out any file names, home directory references, etc.
func CopyDirectory(sourceDirectory, destinationDirectory string) errorCopyDirectory will copy a directory, sub-directories, and files
func CopyFile(sourceFile, destinationFile string) errorCopyFile will copy a file and its relevant permissions
func ExecCommand(utility string, args []string, liveOutput bool) stringExecCommand executes a utility with args and returning the stringified output
func ExecutableExists(executableName string) boolExecutableExists checks if an executable exists
func FindClosestFile(file string) (string, error)FindClosestFile will return the closest related file to the one provided from a specific path
func GetFiles(path string) ([]string, error)GetFiles will get all the files from a directory.
func GetFilesContains(path, substring string) ([]string, error)GetFilesContains will return any files from a directory containing a particular string
func InputMessage(message string) stringInputMessage fetches input after message
func IsDir(path string) boolIsDir checks if the path provided is a directory or not
func OutputStatus(status bool, message string)OutputStatus outputs a "check" or not check based on true / false status, along with the message
func Sha512Sum(content string, rounds int) stringSha512Sum will create a sha512sum of the string
func WriteOrUpdateFile(file string, fileContent []byte, sourceFileMode os.FileMode) errorWriteOrUpdateFile writes or updates the file contents of the passed file under the leading filepath with the specified sourceFileMode