Documentation
¶
Index ¶
- func ArrayContains[T comparable](arr []T, value T) bool
- func CapitalizeWord(word string) string
- func CompressFolder(folder string, destination string) error
- func Die(message string, args ...any)
- func DownloadFile(dlUrl string, path string) error
- func GetFromUrlBytes(dlUrl string) ([]byte, error)
- func GetFromUrlString(dlUrl string) (string, error)
- func GetFullNameFromMailAddress(address string) string
- func GetOutput(commandLine []string, workingDir string) (string, error)
- func Getenv(key string, def string) string
- func Getpwd() string
- func Input(prompt string) (string, error)
- func IsInt(num string) bool
- func Run(commandLine []string, workingDir string) error
- func RunOnSignal(s syscall.Signal, callback func())
- func SafeCharsOnly(str string, safe []byte) bool
- func SemVersionGreater(v1 string, v2 string) bool
- func UncompressFolder(source string, destination string) error
- func Warn(message string, args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayContains ¶
func ArrayContains[T comparable](arr []T, value T) bool
Checks if an element is present in an array. Can be used with any type thanks to generics.
func CapitalizeWord ¶ added in v2.1.0
Capitalizes a first (makes first letter capital).
func CompressFolder ¶
Zips a folder into a file at `destination`.
func Die ¶ added in v2.1.0
Prints the provided error message and exits immediately. `Fatal error: <message>`
func DownloadFile ¶
Downloads file from a url to given location.
func GetFromUrlBytes ¶ added in v2.1.0
Downloads data from a url and returns it as a bytes array.
func GetFromUrlString ¶ added in v2.1.0
Downloads data from a url and returns it as a string.
func GetFullNameFromMailAddress ¶ added in v2.1.0
Capitalizes every part of between periods of the email address before the @-sign. Joins them with " ". Example: "john.doe@example.com" -> "John Doe".
func Getenv ¶ added in v2.1.1
Get environmental variable. If it is not defined (=""), return the provided default value.
func Getpwd ¶
func Getpwd() string
Get current working directory without returning an error. If os.Getwd() throws an error, it tries os.UserHomeDir(). If it also throws an error, returns "".
func RunOnSignal ¶ added in v2.1.0
Runs a function in new goroutine if gets an os signal.
func SafeCharsOnly ¶ added in v2.1.1
Checks if a string contains only provided chars.
func SemVersionGreater ¶
Checks if first semantic version is greater than another.
func UncompressFolder ¶
Unzips a file into `destination`.
Types ¶
This section is empty.