Documentation ¶
Index ¶
- Constants
- Variables
- func AtoInt32(text string) (int32, error)
- func BackupDir() (string, error)
- func BasicAuth(username, password string) string
- func CacheDir() (string, error)
- func ColorNameValues() []string
- func ConfigDir() (string, error)
- func Confirm(message string, defaultValue bool, help string) bool
- func Contains(arr []string, str string) bool
- func CopyDir(src string, dst string, force bool) (err error)
- func CopyDirOverwrite(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func CreateUniqueDirectory(dir string, name string, maximumAttempts int) (string, error)
- func DeleteFile(fileName string) (err error)
- func DownloadFile(filepath string, url string) (err error)
- func DraftDir() (string, error)
- func EnvironmentsDir() (string, error)
- func FileExists(path string) (bool, error)
- func FirstNotEmptyString(values ...string) string
- func FormatDate(t time.Time) string
- func GetColor(optionName string, colorNames []string) (*color.Color, error)
- func GetLatestVersionFromGitHub(githubOwner, githubRepo string) (semver.Version, error)
- func GetLatestVersionStringFromGitHub(githubOwner, githubRepo string) (string, error)
- func GetMockAPIResponseFromFile(dataDir string, route MethodMap) mocker
- func HomeDir() string
- 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 string, err error) error
- func InvalidOptionf(option string, value string, message string, a ...interface{}) error
- func IsEmpty(name string) (bool, error)
- func JXBinLocation() (string, error)
- func JXBinaryLocation(commandInterface CommandInterface) (string, error)
- func LoadBytes(dir, name string) ([]byte, error)
- func LoadCacheData(fileName string, loader CacheLoader) ([]byte, error)
- func MarkdownLink(text string, url string) string
- func MavenBinaryLocation() (string, error)
- func MissingOption(name 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 ParseDate(dateText string) (time.Time, error)
- func PathWithBinary(paths ...string) string
- func PickName(names []string, message string) (string, error)
- func PickNameWithDefault(names []string, message string, defaultValue string) (string, error)
- func PickNames(names []string, message string) ([]string, error)
- func PickPassword(message string) (string, error)
- func PickRequiredNameWithDefault(names []string, message string, defaultValue string) (string, error)
- func PickValue(message string, defaultValue string, required bool) (string, error)
- func PomFlavour(path string) (string, error)
- func RandStringBytesMaskImprSrc(n int) (string, error)
- func RegexpSplit(text string, regexSeperator string) []string
- func RenameDir(src string, dst string, force bool) (err error)
- func RenameFile(src string, dst string) (err error)
- func ReverseStrings(a []string)
- func SelectNames(names []string, message string, selectAll bool) ([]string, error)
- func SelectNamesWithFilter(names []string, message string, selectAll bool, filter string) ([]string, error)
- func SortedMapKeys(m map[string]string) []string
- func StringArrayIndex(array []string, value string) int
- func StringArrayToLower(values []string) []string
- 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 SuggestionsFor(typedName string, values []string, suggestionsMinimumDistance int, ...) []string
- func UnTargz(tarball, target string, onlyFiles []string) error
- func Unzip(src, dest 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) 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) SetExponentialBackOff(backoff *backoff.ExponentialBackOff)
- func (c *Command) SetName(name string)
- func (c *Command) SetTimeout(timeout time.Duration)
- type CommandInterface
- type MethodMap
- type Router
Constants ¶
const ( DefaultWritePermissions = 0760 MaximumNewDirectoryAttempts = 1000 )
const ( ALIGN_LEFT = 0 ALIGN_CENTER = 1 ALIGN_RIGHT = 2 )
const ( APPSERVER = "appserver" LIBERTY = "liberty" )
const DateFormat = "January 2 2006"
const (
DefaultSuggestionsMinimumDistance = 2
)
Variables ¶
var ColorError = color.New(color.FgRed).SprintFunc()
var ColorInfo = color.New(color.FgGreen).SprintFunc()
var ColorStatus = color.New(color.FgBlue).SprintFunc()
var ColorWarning = color.New(color.FgYellow).SprintFunc()
Functions ¶
func ColorNameValues ¶
func ColorNameValues() []string
ColorNameValues returns all the color names sorted
func CopyDirOverwrite ¶
CopyDirOverwrite copies from the source dir to the destination dir overwriting files along the way
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 DeleteFile ¶
func DownloadFile ¶
Download a file from the given URL
func EnvironmentsDir ¶
func FileExists ¶
func FirstNotEmptyString ¶
FirstNotEmptyString returns the first non empty string or the empty string if none can be found
func FormatDate ¶
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_test.go for an example.
func InvalidArg ¶
func InvalidArgError ¶
func InvalidArgf ¶
func InvalidOptionf ¶
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 ¶
func JXBinaryLocation(commandInterface CommandInterface) (string, error)
JXBinaryLocation Returns the path to the currently installed JX binary.
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 MissingOption ¶
func OrganisationsDir ¶
func PathWithBinary ¶
PathWithBinary Sets the $PATH variable. Accepts an optional slice of strings containing paths to add to $PATH
func PickNameWithDefault ¶
func PickPassword ¶
func PomFlavour ¶
func RandStringBytesMaskImprSrc ¶
RandStringBytesMaskImprSrc returns a random hexadecimal string of length n.
func RegexpSplit ¶
RegexpSplit splits a string into an array using the regexSep as a separator
func RenameFile ¶
func ReverseStrings ¶
func ReverseStrings(a []string)
func SelectNames ¶
SelectNames select which names from the list should be chosen
func SelectNamesWithFilter ¶
func SelectNamesWithFilter(names []string, message string, selectAll bool, filter string) ([]string, error)
SelectNamesWithFilter selects from a list of names with a given filter. Optionally selecting them all
func SortedMapKeys ¶
SortedMapKeys returns the sorted keys of the given map
func StringArrayIndex ¶
func StringArrayToLower ¶
StringArrayToLower returns a string slice with all the values converted to lower case
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 SuggestionsFor ¶
func UnTargz ¶
untargz a tarball to a target, from http://blog.ralch.com/tutorial/golang-working-with-tar-and-gzipf
func UrlHostNameWithoutPort ¶
UrlHostNameWithoutPort returns the host name without any port of the given URL like string
Types ¶
type CacheLoader ¶
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 // contains filtered or unexported fields }
Command is a struct containing the details of an external command to be executed
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) 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 CommandInterface ¶
type CommandInterface interface { DidError() bool DidFail() bool Error() error Run() (string, error) RunWithoutRetry() (string, error) SetName(string) SetDir(string) SetArgs([]string) SetTimeout(time.Duration) SetExponentialBackOff(*backoff.ExponentialBackOff) }
CommandInterface defines the interface for a Command