Documentation ¶
Index ¶
- Constants
- func AddTagPrefix(tag string) string
- func Ask(question, expectedResponse string, retries int) (answer string, success bool, err error)
- func CleanLogFile(logPath string) (err error)
- func CopyDirContentsLocal(src, dst string) error
- func CopyFileLocal(src, dst string, required bool) error
- func Exists(path string) bool
- func IsDir(path string) bool
- func MoreRecent(a, b string) (bool, error)
- func PackagesAvailable(packages ...string) (bool, error)
- func RemoveAndReplaceDir(path string) error
- func SemverToTagString(tag semver.Version) string
- func StripControlCharacters(logData []byte) []byte
- func StripSensitiveData(logData []byte) []byte
- func TagStringToSemver(tag string) (semver.Version, error)
- func TrimTagPrefix(tag string) string
- func WrapText(originalText string, lineSize int) (wrappedText string)
- type UserInputError
Constants ¶
const (
TagPrefix = "v"
)
Variables ¶
This section is empty.
Functions ¶
func AddTagPrefix ¶
func Ask ¶
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 ¶
CleanLogFile cleans control characters and sensitive data from a file.
func CopyDirContentsLocal ¶
CopyDirContentsLocal copies local directory contents from one local location to another.
func CopyFileLocal ¶
CopyFileLocal copies a local file from one local location to another.
func MoreRecent ¶
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 ¶
PackagesAvailable takes a slice of packages and determines if they are installed on the host OS. Replaces common::check_packages.
func RemoveAndReplaceDir ¶
RemoveAndReplaceDir removes a directory and its contents then recreates it.
func SemverToTagString ¶
func SemverToTagString(tag semver.Version) string
func StripControlCharacters ¶
StripControlCharacters takes a slice of bytes and removes control characters and bare line feeds (ported from the original bash anago).
func StripSensitiveData ¶
StripSensitiveData removes data deemed sensitive or non public from a byte slice (ported from the original bash anago).
func TagStringToSemver ¶
func TrimTagPrefix ¶
Types ¶
type UserInputError ¶
type UserInputError struct { ErrorString string // contains filtered or unexported fields }
UserInputError a custom error to handle more user input info.
func NewUserInputError ¶
func NewUserInputError(message string, ctrlC bool) UserInputError
NewUserInputError creates a new UserInputError.
func (UserInputError) IsCtrlC ¶
func (e UserInputError) IsCtrlC() bool
IsCtrlC return true if the user has hit Ctrl+C.