Documentation
¶
Index ¶
- Constants
- func CheckUntil(interval time.Duration, timeout time.Duration, predicate func() (bool, error)) error
- func DataFormatFromFileExt(path string, defaultFmt string) string
- func FormatErrorList(errList []error) error
- func GetBMCCredentials(store secrets.SecretStore, id string) bmc.BMCCredentials
- func GetCurrentUsername() string
- func HasErrors(errList []error) bool
- func IPAddrStrToInt(ipStr string) (int, error)
- func IsEmpty[T any](s []T) bool
- func MakeOutputDirectory(path string, overwrite bool) (string, error)
- func PathExists(path string) (fs.FileInfo, bool)
- func SplitPathForViper(path string) (string, string, string)
Constants ¶
const ( FORMAT_LIST = "list" FORMAT_JSON = "json" FORMAT_YAML = "yaml" )
Variables ¶
This section is empty.
Functions ¶
func CheckUntil ¶ added in v0.1.6
func CheckUntil(interval time.Duration, timeout time.Duration, predicate func() (bool, error)) error
CheckUntil regularly check a predicate until it's true or time out is reached.
func DataFormatFromFileExt ¶ added in v0.5.0
func FormatErrorList ¶ added in v0.0.7
FormatErrorList() is a wrapper function that unifies error list formatting and makes printing error lists consistent.
NOTE: The error returned IS NOT an error in itself and may be a bit misleading. Instead, it is a single condensed error composed of all of the errors included in the errList argument.
func GetBMCCredentials ¶ added in v0.2.1
func GetBMCCredentials(store secrets.SecretStore, id string) bmc.BMCCredentials
func GetCurrentUsername ¶ added in v0.3.0
func GetCurrentUsername() string
func HasErrors ¶ added in v0.0.7
HasErrors() is a simple wrapper function to check if an error list contains errors. Having a function that clearly states its purpose helps to improve readibility although it may seem pointless.
func IPAddrStrToInt ¶ added in v0.5.0
func MakeOutputDirectory ¶
MakeOutputDirectory() creates a new directory at the path argument if the path does not exist.
Returns the final path that was created if no errors occurred. Otherwise, it returns an empty string with an error.
func PathExists ¶
PathExists() is a wrapper function that simplifies checking if a file or directory already exists at the provided path.
Returns whether the path exists and no error if successful, otherwise, it returns false with an error.
func SplitPathForViper ¶ added in v0.0.7
SplitPathForViper() is an utility function to split a path into 3 parts: - directory - filename - extension The intent was to break a path into a format that's more easily consumable by spf13/viper's API. See the "LoadConfig()" function in internal/config.go for more details.
TODO: Rename function to something more generalized.
Types ¶
This section is empty.