utils

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExistAndHasContent

func DirExistAndHasContent(dirPath string) error

func FileExistAndItIsAFile

func FileExistAndItIsAFile(filePath string) error

func FileIsNotEmpty

func FileIsNotEmpty(filepath string) error

func FindGitRepoDir

func FindGitRepoDir(levels int) (string, error)

func GenerateRandomString

func GenerateRandomString(opt RandomStringOptions) string

func GetCommandArgs

func GetCommandArgs(cmd string) ([]string, error)

GetCommandArgs parses the job command and returns the arguments.

func GetCurrentDir

func GetCurrentDir() string

func GetHomeDir

func GetHomeDir() string

func GetUUID

func GetUUID() string

func MapIsNulOrEmpty

func MapIsNulOrEmpty(target map[string]string) bool

func MergeSlices

func MergeSlices(slices ...[]string) []string

func NormaliseStringToLower

func NormaliseStringToLower(target string) string

func NormaliseStringToUpper

func NormaliseStringToUpper(target string) string

func RemoveDoubleQuotes

func RemoveDoubleQuotes(target string) string

func RunCommand

func RunCommand(cmd Command) (string, error)

RunCommand runs a command and returns the output.

func WrapAtLength

func WrapAtLength(input string, length int) string

WrapAtLength wraps the input paragraph at the specified length

func WriteFileWithContent

func WriteFileWithContent(filename string, content []byte) error

Types

type Command

type Command struct {
	Binary   string
	Commands []string
}

type RandomStringOptions

type RandomStringOptions struct {
	Length            int
	AllowSpecialChars bool
	UpperLowerRandom  bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL