Documentation ¶
Index ¶
- Constants
- Variables
- func AsBool(unk interface{}) (bool, error)
- func AsFloat64(unk interface{}) (float64, error)
- func AsInt64(unk interface{}) (int64, error)
- func AsMapOfStringsIntefaces(unk interface{}) (map[string]interface{}, error)
- func AsSliceOfStrings(unk interface{}) ([]string, error)
- func AsString(unk interface{}) (string, error)
- func AtoInt32(text string) (int32, error)
- func BackupDir() (string, error)
- func BasicAuth(username, password string) string
- func CacheDir() (string, error)
- func CheckMark() string
- func ColorNameValues() []string
- func CombineErrors(errs ...error) error
- func CombineMapTrees(destination map[string]interface{}, input map[string]interface{})
- func ConfigDir() (string, error)
- func Confirm(message string, defaultValue bool, help string, in terminal.FileReader, ...) bool
- func Contains(arr []string, str string) bool
- func ContentTypeForFileName(name string) string
- func ConvertAllMapKeysToString(i interface{}) interface{}
- func CopyDir(src string, dst string, force bool) (err error)
- func CopyDirOverwrite(src string, dst string) (err error)
- func CopyDirPreserve(src string, dst string) error
- func CopyFile(src, dst string) (err error)
- func CopyFileOrDir(src string, dst string, force bool) (err error)
- func CreateUniqueDirectory(dir string, name string, maximumAttempts int) (string, error)
- func DeleteDirContents(dir string) error
- func DeleteDirContentsExcept(dir string, exceptDir string) error
- func DeleteFile(fileName string) (err error)
- func DereferenceFloat64(f *float64) float64
- func DereferenceInt(i *int) int
- func DereferenceString(s *string) string
- func DestroyFile(filename string) error
- func DiffSlices(oldSlice []string, newSlice []string) ([]string, []string)
- func DirExists(path string) (bool, error)
- func DownloadFile(filepath string, url string) (err error)
- func DraftDir() (string, error)
- func EncodeKubernetesName(name string) string
- func EnvironmentsDir() (string, error)
- func FileExists(path string) (bool, error)
- func FileIsEmpty(path string) (bool, error)
- func FilterFileExists(paths []string) []string
- func FirstFileExists(paths ...string) (string, error)
- func FirstNotEmptyString(values ...string) string
- func FormatDate(t time.Time) string
- func GetAndCleanEnviron(keys []string) (map[string]string, error)
- func GetClient() *http.Client
- func GetClientWithTimeout(duration time.Duration) *http.Client
- func GetColor(optionName string, colorNames []string) (*color.Color, error)
- func GetCustomClient(transport http.RoundTripper, timeout int) *http.Client
- func GetLatestFullTagFromGithub(githubOwner, githubRepo string) (string, error)
- func GetLatestReleaseFromGitHub(githubOwner, githubRepo string) (string, error)
- func GetLatestTagFromGithub(githubOwner, githubRepo string) (string, error)
- func GetLatestVersionFromGitHub(githubOwner, githubRepo string) (semver.Version, error)
- func GetLatestVersionStringFromGitHub(githubOwner, githubRepo string) (string, error)
- func GetMockAPIResponseFromFile(dataDir string, route MethodMap) mocker
- func GetModuleRequirements(dir string) (map[string]map[string]string, error)
- func GetTagsFromGithub(githubOwner, githubRepo string) ([]*github.RepositoryTag, error)
- func GlobAllFiles(basedir string, pattern string, fn func(string) error) error
- func HashPassword(password string) string
- func HomeDir() string
- func IgnoreFile(path string, ignores []string) (bool, error)
- func Int32ToA(n int32) string
- func InvalidArg(value string, values []string) error
- func InvalidArgError(value string, err error) error
- func InvalidArgf(value string, message string, a ...interface{}) error
- func InvalidOption(name string, value string, values []string) error
- func InvalidOptionError(option string, value interface{}, err error) error
- func InvalidOptionf(option string, value interface{}, message string, a ...interface{}) error
- func IsEmpty(name string) (bool, error)
- func IsZeroOfUnderlyingType(x interface{}) bool
- func JXBinLocation() (string, error)
- func JXBinaryLocation() (string, error)
- func KillProcesses(binary string) error
- func KillProcessesTree(binary string, processes []*process.Process, m map[int32]bool) (bool, error)
- func ListDirectory(root string, recurse bool) error
- func LoadBytes(dir, name string) ([]byte, error)
- func LoadCacheData(fileName string, loader CacheLoader) ([]byte, error)
- func LogsDir() (string, error)
- func MapKeys(m map[string]string) []string
- func MarkdownLink(text string, url string) string
- func MavenBinaryLocation() (string, error)
- func MergeMaps(maps ...map[string]string) map[string]string
- func MissingArgument(name string) error
- func MissingOption(name string) error
- func MissingOptionWithOptions(name string, options []string) error
- func OrganisationsDir() (string, error)
- func Pad(s, pad string, width int, align int) string
- func PadCenter(s, pad string, width int) string
- func PadLeft(s, pad string, width int) string
- func PadRight(s, pad string, width int) string
- func ParseBool(text string) (bool, error)
- func ParseDate(dateText string) (time.Time, error)
- func PathWithBinary(paths ...string) string
- func PickName(names []string, message string, help string, in terminal.FileReader, ...) (string, error)
- func PickNameWithDefault(names []string, message string, defaultValue string, help string, ...) (string, error)
- func PickNames(names []string, message string, help string, in terminal.FileReader, ...) ([]string, error)
- func PickNamesWithDefaults(names []string, defaults []string, message string, help string, ...) ([]string, error)
- func PickPassword(message string, help string, in terminal.FileReader, out terminal.FileWriter, ...) (string, error)
- func PickRequiredNameWithDefault(names []string, message string, defaultValue string, help string, ...) (string, error)
- func PickValue(message string, defaultValue string, required bool, help string, ...) (string, error)
- func PluginBinDir(ns string) (string, error)
- func PomFlavour(path string) (string, error)
- func RandStringBytesMaskImprSrc(n int) (string, error)
- func RecreateDirs(dirs ...string) error
- func RegexpSplit(text string, regexSeperator string) []string
- func RemoveStringFromSlice(strings []string, toRemove string) []string
- func RenameDir(src string, dst string, force bool) (err error)
- func RenameFile(src string, dst string) (err error)
- func RestoreEnviron(environ map[string]string) error
- func Retry(maxElapsedTime time.Duration, f func() error) error
- func RetryWithInitialDelay(initialDelay, maxElapsedTime time.Duration, f func() error) error
- func RetryWithInitialDelaySlower(initialDelay, maxElapsedTime time.Duration, f func() error) error
- func ReverseStrings(a []string)
- func RunCommandBackground(name string, output io.Writer, verbose bool, args ...string) error
- func SelectNames(names []string, message string, selectAll bool, help string, ...) ([]string, error)
- func SelectNamesWithFilter(names []string, message string, selectAll bool, filter string, help string, ...) ([]string, error)
- func SetMapValueViaPath(m map[string]interface{}, path string, value interface{})
- func SortedMapKeys(m map[string]string) []string
- func StringArrayHasPrefixIndex(array []string, prefix string) int
- func StringArrayIndex(array []string, value string) int
- func StringArrayToLower(values []string) []string
- func StringArraysEqual(a1 []string, a2 []string) bool
- func StringIndexes(text string, value string) []int
- func StringMapHasValue(m map[string]string, value string) bool
- func StringMatchesAny(text string, includes []string, excludes []string) bool
- func StringMatchesPattern(text string, pattern string) bool
- func StringsContaining(slice []string, filter string) []string
- func StripCredentialsFromURL(u *url.URL) string
- func SuggestionsFor(typedName string, values []string, suggestionsMinimumDistance int, ...) []string
- func ToMapStringInterfaceFromStruct(obj interface{}) (map[string]interface{}, error)
- func ToStringMapStringFromStruct(obj interface{}) map[string]string
- func ToStructFromMapStringInterface(m map[string]interface{}, str interface{}) error
- func URLEqual(url1, url2 string) bool
- func UnTargz(tarball, target string, onlyFiles []string) error
- func UnTargzAll(tarball, target string) error
- func Unzip(src, dest string) error
- func UnzipSpecificFiles(src, dest string, onlyFiles ...string) error
- func UrlHostNameWithoutPort(rawUri string) (string, error)
- func UrlJoin(paths ...string) string
- type CacheLoader
- type Command
- func (c *Command) Attempts() int
- func (c *Command) CurrentArgs() []string
- func (c *Command) CurrentDir() string
- func (c *Command) CurrentEnv() map[string]string
- func (c *Command) CurrentName() string
- func (c *Command) DidError() bool
- func (c *Command) DidFail() bool
- func (c *Command) Error() error
- func (c *Command) Run() (string, error)
- func (c *Command) RunWithoutRetry() (string, error)
- func (c *Command) SetArgs(args []string)
- func (c *Command) SetDir(dir string)
- func (c *Command) SetEnv(env map[string]string)
- func (c *Command) SetEnvVariable(name string, value string)
- func (c *Command) SetExponentialBackOff(backoff *backoff.ExponentialBackOff)
- func (c *Command) SetName(name string)
- func (c *Command) SetTimeout(timeout time.Duration)
- func (c *Command) String() string
- type CommandError
- type Commander
- type MethodMap
- type Router
Constants ¶
const ( DefaultWritePermissions = 0760 MaximumNewDirectoryAttempts = 1000 )
const ( ALIGN_LEFT = 0 ALIGN_CENTER = 1 ALIGN_RIGHT = 2 )
const ( MAVEN = "maven" MAVEN_JAVA11 = "maven-java11" APPSERVER = "appserver" LIBERTY = "liberty" DROPWIZARD = "dropwizard" )
const DateFormat = "January 2 2006"
const (
DefaultSuggestionsMinimumDistance = 2
)
Variables ¶
var ColorError = color.New(color.FgRed).SprintFunc()
ColorError returns a new function that returns error-colorized (red) strings for the given arguments with fmt.Sprint().
var ColorInfo = color.New(color.FgGreen).SprintFunc()
ColorInfo returns a new function that returns info-colorized (green) strings for the given arguments with fmt.Sprint().
var ColorStatus = color.New(color.FgBlue).SprintFunc()
ColorStatus returns a new function that returns status-colorized (blue) strings for the given arguments with fmt.Sprint().
var ColorWarning = color.New(color.FgYellow).SprintFunc()
ColorWarning returns a new function that returns warning-colorized (yellow) strings for the given arguments with fmt.Sprint().
Functions ¶
func AsMapOfStringsIntefaces ¶ added in v1.3.896
AsMapOfStringsIntefaces attempts to convert unk to a map[string]interface{}
func AsSliceOfStrings ¶
AsSliceOfStrings attempts to convert unk to a slice of strings
func CheckMark ¶
func CheckMark() string
CheckMark returns the check mark unicode character. We could configure this to use no color or avoid unicode using platform, env vars or config?
func ColorNameValues ¶
func ColorNameValues() []string
ColorNameValues returns all the color names sorted
func CombineErrors ¶
Combine combines the non null errors into a single error or returns null
func CombineMapTrees ¶
CombineMapTrees recursively copies all the values from the input map into the destination map preserving any missing entries in the destination
func Confirm ¶
func Confirm(message string, defaultValue bool, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) bool
Confirm prompts the user to confirm something
func ContentTypeForFileName ¶
ContentTypeForFileName returns the MIME type for the given file name
func ConvertAllMapKeysToString ¶
func ConvertAllMapKeysToString(i interface{}) interface{}
ConvertAllMapKeysToString will recursively go through an object and convert all keys of a map (and any submaps) to Strings. This is necessary for json handlers (eg vault) where an item of a submap must be map[string]interface{} rather than the more lenient map[interface{}]interface{} that you get from yaml unmarshalling
func CopyDirOverwrite ¶
CopyDirOverwrite copies from the source dir to the destination dir overwriting files along the way
func CopyDirPreserve ¶ added in v1.3.818
CopyDirPreserve copies from the src dir to the dst dir if the file does NOT already exist in dst
func CopyFileOrDir ¶
CopyFileOrDir copies the source file or directory to the given destination
func CreateUniqueDirectory ¶
CreateUniqueDirectory creates a new directory but if the combination of dir and name exists then append a number until a unique name is found
func DeleteDirContents ¶
DeleteDirContents removes all the contents of the given directory
func DeleteDirContentsExcept ¶ added in v1.3.972
func DeleteFile ¶
DeleteFile deletes a file from the operating system. This should NOT be used to delete any sensitive information because it can easily be recovered. Use DestroyFile to delete sensitive information
func DereferenceFloat64 ¶
DereferenceFloat64 will return the float64 value or the empty value for float64
func DereferenceInt ¶
DereferenceInt will return the int value or the empty value for int
func DereferenceString ¶
DereferenceString will return the string value or the empty value for string
func DestroyFile ¶
DestroyFile will securely delete a file by first overwriting it with random bytes, then deleting it. This should always be used for deleting sensitive information
func DiffSlices ¶
DiffSlices compares the two slices and returns an array of items to delete from the old slice and a slice of new values to add to
func DownloadFile ¶
Download a file from the given URL
func EncodeKubernetesName ¶
EncodeKubernetesName takes a string and turns it into a form suitable for use as a Kubernetes name. Note there is no decode functionality provided atm (and things like escaping escape codes aren't handled), so round-tripping is not possible yet. K8S names are lower case, numbers, '-', and '.'. Invalid characters are percent-encoded in a _similar_ way to URL encoding, with a period ('.') followed by the numerical character code. Conversion is:
Upper case letters -> lower case. 'a-z', '0-9', '-', '.' -> left as-is. Any other characters: percent-encoded ('.' + rune hex code).
func EnvironmentsDir ¶
func FileExists ¶
func FileIsEmpty ¶
FileIsEmpty checks if a file is empty
func FilterFileExists ¶
FilterFileExists filters out files which do not exist
func FirstFileExists ¶
FirstFileExists returns the first file which exists or an error if we can't detect if a file that exists
func FirstNotEmptyString ¶
FirstNotEmptyString returns the first non empty string or the empty string if none can be found
func FormatDate ¶
func GetAndCleanEnviron ¶
GetAndCleanEnviron cleans the provided env variables and returns their current value
func GetClientWithTimeout ¶
GetClientWithTimeout returns a client with JX default transport and user specified timeout
func GetCustomClient ¶
func GetCustomClient(transport http.RoundTripper, timeout int) *http.Client
GetCustomClient returns a client with user specified transport and timeout (in seconds)
func GetLatestFullTagFromGithub ¶
GetLatestFullTagFromGithub gets the latest 'full' tag from a specific github repo. This (at present) ignores releases with a hyphen in it, usually used with -SNAPSHOT, or -RC1 or -beta
func GetLatestReleaseFromGitHub ¶
GetLatestReleaseFromGitHub gets the latest Release from a specific github repo
func GetLatestTagFromGithub ¶
GetLatestTagFromGithub gets the latest (in github order) tag from a specific github repo
func GetMockAPIResponseFromFile ¶
@param dataDir Location of test data json file @param router Should map a URL path to a map that maps a method to a JSON response file name. Conceptually: (url, method) -> file See pkg/gits/bitbucket_cloud_test.go for an example.
func GetModuleRequirements ¶ added in v1.3.818
GetModuleRequirements returns the requirements for the GO module rooted in dir It returns a map[<module name>]map[<requirement name>]<requirement version>
func GetTagsFromGithub ¶
func GetTagsFromGithub(githubOwner, githubRepo string) ([]*github.RepositoryTag, error)
GetTagsFromGithub gets the list of tags on a specific github repo
func GlobAllFiles ¶
GlobAllFiles performs a glob on the pattern and then processes all the files found. if a folder matches the glob its treated as another glob to recurse into the directory
func HashPassword ¶
HashPassword hashes the given password with SHA1
func IgnoreFile ¶
IgnoreFile returns true if the path matches any of the ignores. The match is the same as filepath.Match.
func InvalidArg ¶
func InvalidArgError ¶
func InvalidArgf ¶
func InvalidOptionError ¶
InvalidOptionError returns an error that shows the invalid option
func InvalidOptionf ¶
InvalidOptionf returns an error that shows the invalid option
func IsZeroOfUnderlyingType ¶
func IsZeroOfUnderlyingType(x interface{}) bool
IsZeroOfUnderlyingType checks if the underlying type of the interface is set to it's zero value
func JXBinLocation ¶
JXBinLocation finds the JX config directory and creates a bin directory inside it if it does not already exist. Returns the JX bin path
func JXBinaryLocation ¶
JXBinaryLocation Returns the path to the currently installed JX binary.
func KillProcesses ¶
func KillProcessesTree ¶
func ListDirectory ¶
ListDirectory logs the directory at path
func LoadCacheData ¶
func LoadCacheData(fileName string, loader CacheLoader) ([]byte, error)
LoadCacheData loads cached data from the given cache file name and loader
func MarkdownLink ¶
MarkdownLink returns a markdown link
func MavenBinaryLocation ¶
func MergeMaps ¶
MergeMaps merges all the maps together with the entries in the last map overwriting any earlier values
so if you want to add some annotations to a resource you can do resource.Annotations = kube.MergeMaps(resource.Annotations, myAnnotations)
func MissingArgument ¶
MissingArgument reports a missing command line argument name
func MissingOption ¶
MissingOption reports a missing command line option using the full name expression
func MissingOptionWithOptions ¶
MissingOptionWithOptions reports a missing command line option using the full name expression along with a list of available values
func OrganisationsDir ¶
func PathWithBinary ¶
PathWithBinary Sets the $PATH variable. Accepts an optional slice of strings containing paths to add to $PATH
func PickName ¶
func PickName(names []string, message string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
PickName gets the user to pick an option from a list of options
func PickNameWithDefault ¶
func PickNameWithDefault(names []string, message string, defaultValue string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
PickNameWithDefault gets the user to pick an option from a list of options, with a default option specified
func PickNames ¶
func PickNames(names []string, message string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) ([]string, error)
PickNames gets the user to pick multiple selections from a list of options
func PickNamesWithDefaults ¶ added in v1.3.932
func PickNamesWithDefaults(names []string, defaults []string, message string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) ([]string, error)
PickNamesWithDefaults gets the user to pick multiple selections from a list of options with a set of default selections
func PickPassword ¶
func PickPassword(message string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
PickPassword gets a password (via hidden input) from a user's free-form input
func PickRequiredNameWithDefault ¶
func PickRequiredNameWithDefault(names []string, message string, defaultValue string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
PickRequiredNameWithDefault gets the user to pick an option from a list of options, with a default option specified
func PickValue ¶
func PickValue(message string, defaultValue string, required bool, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
PickValue gets an answer to a prompt from a user's free-form input
func PluginBinDir ¶
PluginBinDir returns the plugin bin directory for the given ns
func PomFlavour ¶
func RandStringBytesMaskImprSrc ¶
RandStringBytesMaskImprSrc returns a random hexadecimal string of length n.
func RecreateDirs ¶
DeleteDirContents removes all the contents of the given directory
func RegexpSplit ¶
RegexpSplit splits a string into an array using the regexSep as a separator
func RemoveStringFromSlice ¶
RemoveStringFromSlice removes the first occurence of the specified string from a slice, if it exists and returns the result
func RenameFile ¶
func RestoreEnviron ¶
RestoreEnviron sets the in the environment the environment variables provided as input
func RetryWithInitialDelay ¶ added in v1.3.822
RetryWithInitialDelay retires with exponential backoff and initial delay the given function
func RetryWithInitialDelaySlower ¶ added in v1.3.822
RetryWithInitialDelaySlower retries with exponential backoff, an initial delay and with a slower rate
func ReverseStrings ¶
func ReverseStrings(a []string)
func RunCommandBackground ¶
func SelectNames ¶
func SelectNames(names []string, message string, selectAll bool, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) ([]string, error)
SelectNames select which names from the list should be chosen
func SelectNamesWithFilter ¶
func SelectNamesWithFilter(names []string, message string, selectAll bool, filter string, help string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) ([]string, error)
SelectNamesWithFilter selects from a list of names with a given filter. Optionally selecting them all
func SetMapValueViaPath ¶ added in v1.3.908
SetMapValueViaPath sets the map key using the given path which supports the form `foo.bar.whatnot` to mean `m["foo"]["bar"]["whatnot"]` lazily creating maps as the path is navigated
func SortedMapKeys ¶
SortedMapKeys returns the sorted keys of the given map
func StringArrayHasPrefixIndex ¶
StringArrayHasPrefixIndex returns the index in the slice which the value has the given prefix
func StringArrayIndex ¶
StringArrayIndex returns the index in the slice which equals the given value
func StringArrayToLower ¶
StringArrayToLower returns a string slice with all the values converted to lower case
func StringArraysEqual ¶
StringArraysEqual returns true if the two string slices are equal
func StringIndexes ¶
StringIndexes returns all the indices where the value occurs in the given string
func StringMapHasValue ¶
StringMapHasValue returns true if the given map contains the given value
func StringMatchesAny ¶
StringMatches returns true if the given text matches the includes/excludes lists
func StringMatchesPattern ¶
StringMatchesPattern returns true if the given text matches the includes/excludes lists
func StringsContaining ¶
StringsContaining if the filter is not empty return all the strings which contain the text
func StripCredentialsFromURL ¶ added in v1.3.914
StripCredentialsFromURL strip credentials from URL
func SuggestionsFor ¶
func ToMapStringInterfaceFromStruct ¶
ToMapStringInterfaceFromStruct marshals a struct to a generic map[string]interface{} by marshalling it to json and back Use JSON for the marshalling instead of YAML because sub-structs will get marshalled into map[interface{}]interface{} when using YAML, but map[string]interface{} when using JSON and vault libraries can't handle map[interface{}]interface{}
func ToStringMapStringFromStruct ¶
ToStringMapStringFromStruct returns string[map]string from any struct. Use structs tag to change map keys. e.g. ServerName string `structs:"server_name"`
func ToStructFromMapStringInterface ¶
ToStructFromMapStringInterface marshals a generic map[string]interface{} to a struct by marshalling to json and back Use JSON for the marshalling instead of YAML because sub-structs will get marshalled into map[interface{}]interface{} when using YAML, but map[string]interface{} when using JSON and vault libraries can't handle map[interface{}]interface{}
func UnTargz ¶
untargz a tarball to a target, from http://blog.ralch.com/tutorial/golang-working-with-tar-and-gzipf
func UnTargzAll ¶
untargz a tarball to a target including any folders inside the tarball http://blog.ralch.com/tutorial/golang-working-with-tar-and-gzipf
func Unzip ¶
Unzips the archvie into the specified directory returns an error if a general issue occurred unzipping the archive
func UnzipSpecificFiles ¶
Unzips the specified files from the archive returns an error if any of the specified files are not found or a general issue occurred unzipping the archive
func UrlHostNameWithoutPort ¶
UrlHostNameWithoutPort returns the host name without any port of the given URL like string
Types ¶
type CacheLoader ¶
CacheLoader defines cache value population callback that should be executed if cache entry with given key is not present.
type Command ¶
type Command struct { Errors []error Dir string Name string Args []string ExponentialBackOff *backoff.ExponentialBackOff Timeout time.Duration Out io.Writer Err io.Writer Env map[string]string // contains filtered or unexported fields }
Command is a struct containing the details of an external command to be executed
func (*Command) CurrentArgs ¶
CurrentArgs returns the current command arguments
func (*Command) CurrentDir ¶
CurrentDir returns the current Dir
func (*Command) CurrentEnv ¶
CurrentEnv returns the current envrionment variables
func (*Command) CurrentName ¶
CurrentName returns the current name of the command
func (*Command) DidError ¶
DidError returns a boolean if any error occurred in any execution of the command
func (*Command) DidFail ¶
DidFail returns a boolean if the command could not complete (errored on every attempt)
func (*Command) RunWithoutRetry ¶
RunWithoutRetry Execute the command without retrying on failure and block waiting for return values
func (*Command) SetArgs ¶
SetArgs Setter method for Args to enable use of interface instead of Command struct
func (*Command) SetDir ¶
SetDir Setter method for Dir to enable use of interface instead of Command struct
func (*Command) SetEnv ¶
SetEnv Setter method for Env to enable use of interface instead of Command struct
func (*Command) SetEnvVariable ¶
SetEnvVariable sets an environment variable into the environment
func (*Command) SetExponentialBackOff ¶
func (c *Command) SetExponentialBackOff(backoff *backoff.ExponentialBackOff)
SetExponentialBackOff Setter method for ExponentialBackOff to enable use of interface instead of Command struct
func (*Command) SetName ¶
SetName Setter method for Name to enable use of interface instead of Command struct
func (*Command) SetTimeout ¶
SetTimeout Setter method for Timeout to enable use of interface instead of Command struct
type CommandError ¶
type CommandError struct { Command Command Output string // contains filtered or unexported fields }
CommandError is the error object encapsulating an error from a Command
func (CommandError) Error ¶
func (c CommandError) Error() string
type Commander ¶
type Commander interface { DidError() bool DidFail() bool Error() error Run() (string, error) RunWithoutRetry() (string, error) SetName(string) CurrentName() string SetDir(string) CurrentDir() string SetArgs([]string) CurrentArgs() []string SetTimeout(time.Duration) SetExponentialBackOff(*backoff.ExponentialBackOff) SetEnv(map[string]string) CurrentEnv() map[string]string SetEnvVariable(string, string) }
Commander defines the interface for a Command