const (
TagPrefix = "v"
)
func AddTagPrefix(tag string) string
func Ask(question, expectedResponse string, retries int) (answer string, success bool, err error)
Ask asks the user a question, expecting a known response expectedResponse
You may specify a single response as a string or a series of valid/invalid responses with an optional default.
To specify the valid responses, either pass a string or craft a series of answers using the following format:
"|successAnswers|nonSuccessAnswers|defaultAnswer"
The successAnswers and nonSuccessAnswers can be either a string or a series os responses like:
"|opt1a:opt1b|opt2a:opt2b|defaultAnswer"
This example will accept opt1a and opt1b as successful answers, opt2a and opt2b as unsuccessful answers and in case of an empty answer, it will return "defaultAnswer" as success.
To consider the default as a success, simply list them with the rest of the non successful answers.
func CleanLogFile(logPath string) (err error)
CleanLogFile cleans control characters and sensitive data from a file
func CopyDirContentsLocal(src, dst string) error
CopyDirContentsLocal copies local directory contents from one local location to another.
func CopyFileLocal(src, dst string, required bool) error
CopyFileLocal copies a local file from one local location to another.
func Exists(path string) bool
Exists indicates whether a file exists.
func MoreRecent(a, b string) (bool, error)
MoreRecent determines if file at path a was modified more recently than file at path b. If one file does not exist, the other will be treated as most recent. If both files do not exist or an error occurs, an error is returned.
func PackagesAvailable(packages ...string) (bool, error)
PackagesAvailable takes a slice of packages and determines if they are installed on the host OS. Replaces common::check_packages.
func RemoveAndReplaceDir(path string) error
RemoveAndReplaceDir removes a directory and its contents then recreates it.
func SemverToTagString(tag semver.Version) string
func StripControlCharacters(logData []byte) []byte
StripControlCharacters takes a slice of bytes and removes control characters and bare line feeds (ported from the original bash anago)
func StripSensitiveData(logData []byte) []byte
StripSensitiveData removes data deemed sensitive or non public from a byte slice (ported from the original bash anago)
func TagStringToSemver(tag string) (semver.Version, error)
func TrimTagPrefix(tag string) string
func WrapText(originalText string, lineSize int) (wrappedText string)
WrapText wraps a text
UserInputError a custom error to handle more user input info
type UserInputError struct { ErrorString string // contains filtered or unexported fields }
func NewUserInputError(message string, ctrlC bool) UserInputError
NewUserInputError creates a new UserInputError
func (e UserInputError) Error() string
Error return the error string
func (e UserInputError) IsCtrlC() bool
IsCtrlC return true if the user has hit Ctrl+C