Documentation ¶
Index ¶
- func ConvertEnvVars(envVarsMap map[any]any) []string
- func ConvertPathsToAbsolutePaths(paths []string) ([]string, error)
- func EnsureDir(fileName string) error
- func FileExists(filename string) bool
- func GetGlobMatches(pattern string) ([]string, error)
- func IsDirectory(path string) (bool, error)
- func IsPathAbsolute(path string) bool
- func IsYaml(file string) bool
- func JoinAbsolutePathWithPath(basePath string, providedPath string) (string, error)
- func JoinAbsolutePathWithPaths(basePath string, paths []string) ([]string, error)
- func MapKeyExists(m map[string]any, key string) bool
- func PathMatch(pattern, name string) (bool, error)
- func PrintAsJSON(data any) error
- func PrintAsYAML(data any) error
- func PrintError(err error)
- func PrintErrorToStdError(err error)
- func PrintErrorToStdErrorAndExit(err error)
- func PrintErrorVerbose(err error)
- func PrintInfo(message string)
- func PrintInfoVerbose(message string)
- func PrintMessage(message string)
- func PrintMessageVerbose(message string)
- func SliceContainsInt(s []int, i int) bool
- func SliceContainsString(s []string, str string) bool
- func SliceContainsStringStartsWith(s []string, str string) bool
- func SliceOfStringsToSpaceSeparatedString(s []string) string
- func StringKeysFromMap(m map[string]any) []string
- func TrimBasePathFromPath(basePath string, path string) string
- func UniqueStrings(input []string) []string
- func WriteToFileAsJSON(filePath string, data any, fileMode os.FileMode) error
- func WriteToFileAsYAML(filePath string, data any, fileMode os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertEnvVars ¶ added in v1.4.22
ConvertEnvVars convert ENV vars from a map to a list of strings in the format ["key1=val1", "key2=val2", "key3=val3" ...]
func ConvertPathsToAbsolutePaths ¶
ConvertPathsToAbsolutePaths converts a slice of paths to a slice of absolute paths
func EnsureDir ¶ added in v1.5.0
EnsureDir accepts a file path and creates all the intermediate subdirectories
func FileExists ¶
FileExists checks if a file exists and is not a directory
func GetGlobMatches ¶ added in v1.4.21
GetGlobMatches tries to read and return the Glob matches content from the sync map if it exists in the map, otherwise it finds and returns all files matching the pattern, stores the files in the map and returns the files
func IsDirectory ¶
IsDirectory checks if the path is a directory
func IsPathAbsolute ¶ added in v1.4.0
IsPathAbsolute checks if the provided file path is absolute
func IsYaml ¶
IsYaml checks if the file has YAML extension (does not check file schema, nor validates the file)
func JoinAbsolutePathWithPath ¶ added in v1.4.27
JoinAbsolutePathWithPath checks if the provided path is absolute. If the provided path is relative, it joins the base path with the path and returns the absolute path
func JoinAbsolutePathWithPaths ¶
JoinAbsolutePathWithPaths joins a base path with each item in the path slice and returns a slice of absolute paths
func MapKeyExists ¶ added in v1.4.1
MapKeyExists checks if a key already defined in a map
func PathMatch ¶ added in v1.4.21
PathMatch returns true if `name` matches the file name `pattern`. PathMatch will automatically use your system's path separator to split `name` and `pattern`. On systems where the path separator is `'\'`, escaping will be disabled.
Note: this is meant as a drop-in replacement for filepath.Match(). It assumes that both `pattern` and `name` are using the system's path separator. If you can't be sure of that, use filepath.ToSlash() on both `pattern` and `name`, and then use the Match() function instead.
func PrintAsJSON ¶
PrintAsJSON prints the provided value as YAML document to the console
func PrintAsYAML ¶
PrintAsYAML prints the provided value as YAML document to the console
func PrintError ¶ added in v1.3.26
func PrintError(err error)
PrintError prints errors to std.Output
func PrintErrorToStdError ¶ added in v1.4.10
func PrintErrorToStdError(err error)
PrintErrorToStdError prints errors to std.Error
func PrintErrorToStdErrorAndExit ¶ added in v1.3.26
func PrintErrorToStdErrorAndExit(err error)
PrintErrorToStdErrorAndExit prints errors to std.Error and exits with an error code
func PrintErrorVerbose ¶ added in v1.4.26
func PrintErrorVerbose(err error)
PrintErrorVerbose checks the log level and prints errors to std.Output
func PrintInfo ¶ added in v1.4.12
func PrintInfo(message string)
PrintInfo prints the provided info message
func PrintInfoVerbose ¶ added in v1.4.12
func PrintInfoVerbose(message string)
PrintInfoVerbose checks the log level and prints the provided info message
func PrintMessage ¶ added in v1.5.0
func PrintMessage(message string)
PrintMessage prints the provided message to the console
func PrintMessageVerbose ¶ added in v1.5.0
func PrintMessageVerbose(message string)
PrintMessageVerbose checks the log level and prints the provided message to the console
func SliceContainsInt ¶
SliceContainsInt checks if an int is present in a slice
func SliceContainsString ¶
SliceContainsString checks if a string is present in a slice
func SliceContainsStringStartsWith ¶
SliceContainsStringStartsWith checks if a slice contains a string that the given string begins with
func SliceOfStringsToSpaceSeparatedString ¶
SliceOfStringsToSpaceSeparatedString checks if an int is present in a slice
func StringKeysFromMap ¶
StringKeysFromMap returns a slice of sorted string keys from the provided map
func TrimBasePathFromPath ¶
TrimBasePathFromPath trims the base path prefix from the path
func UniqueStrings ¶
UniqueStrings returns a unique subset of the string slice provided
func WriteToFileAsJSON ¶
WriteToFileAsJSON converts the provided value to YAML and writes it to the provided file
Types ¶
This section is empty.