Skip to content

A package of common utilities for command execution, input, and IO.

License

Notifications You must be signed in to change notification settings

TryStreambits/coreutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coreutils

A package of common utilities for command execution, input, and IO.

License

coreutils is licensed under Apache-2.0

Usage

Import

import "github.com/StroblIndustries/coreutils"

Variables

var GlobalFileMode os.FileMode

GlobalFileMode is a file mode we'll use for global IO operations.

var NonGlobalFileMode os.FileMode

NonGlobalFileMode is the file mode we'll use for non-global IO operations.

Functions

func AbsPath

func AbsPath(path string) string

AbsPath get the absolute directory path, cleaning out any file names, home directory references, etc.

func CopyDirectory

func CopyDirectory(sourceDirectory, destinationDirectory string) error

CopyDirectory will copy a directory, sub-directories, and files

func CopyFile

func CopyFile(sourceFile, destinationFile string) error

CopyFile will copy a file and its relevant permissions

func ExecCommand

func ExecCommand(utility string, args []string, liveOutput bool) string

ExecCommand executes a utility with args and returning the stringified output

func ExecutableExists

func ExecutableExists(executableName string) bool

ExecutableExists checks if an executable exists

func FindClosestFile

func FindClosestFile(file string) (string, error)

FindClosestFile will return the closest related file to the one provided from a specific path

func GetFiles

func GetFiles(path string) ([]string, error)

GetFiles will get all the files from a directory.

func GetFilesContains

func GetFilesContains(path, substring string) ([]string, error)

GetFilesContains will return any files from a directory containing a particular string

func InputMessage

func InputMessage(message string) string

InputMessage fetches input after message

func IsDir

func IsDir(path string) bool

IsDir checks if the path provided is a directory or not

func OutputStatus

func OutputStatus(status bool, message string)

OutputStatus outputs a "check" or not check based on true / false status, along with the message

func Sha512Sum

func Sha512Sum(content string, rounds int) string

Sha512Sum will create a sha512sum of the string

func WriteOrUpdateFile

func WriteOrUpdateFile(file string, fileContent []byte, sourceFileMode os.FileMode) error

WriteOrUpdateFile writes or updates the file contents of the passed file under the leading filepath with the specified sourceFileMode

About

A package of common utilities for command execution, input, and IO.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages