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 CombineErrors(errs ...error) error
- func ConfigDir() (string, error)
- func Confirm(message string, defaultValue bool, help string, in terminal.FileReader, ...) 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 DeleteDirContents(dir string) error
- func DeleteFile(fileName string) (err error)
- func DiffSlices(oldSlice []string, newSlice []string) ([]string, []string)
- 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 Commander) (string, error)
- func LoadBytes(dir, name string) ([]byte, error)
- func LoadCacheData(fileName string, loader CacheLoader) ([]byte, error)
- func LogsDir() (string, 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, in terminal.FileReader, ...) (string, error)
- func PickNameWithDefault(names []string, message string, defaultValue string, in terminal.FileReader, ...) (string, error)
- func PickNames(names []string, message string, in terminal.FileReader, ...) ([]string, error)
- func PickPassword(message string, in terminal.FileReader, out terminal.FileWriter, ...) (string, error)
- func PickRequiredNameWithDefault(names []string, message string, defaultValue string, in terminal.FileReader, ...) (string, error)
- func PickValue(message string, defaultValue string, required bool, in terminal.FileReader, ...) (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 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, in terminal.FileReader, ...) ([]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 ToStringMapStringFromStruct(obj interface{}) map[string]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 Commander
- 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 ¶ added in v1.3.49
func ColorNameValues() []string
ColorNameValues returns all the color names sorted
func CombineErrors ¶ added in v1.3.336
Combine combines the non null errors into a single error or returns null
func Confirm ¶ added in v1.1.4
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 CopyDir ¶ added in v1.0.75
credit https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04
func CopyDirOverwrite ¶ added in v1.2.67
CopyDirOverwrite copies from the source dir to the destination dir overwriting files along the way
func CopyFile ¶ added in v1.0.75
credit https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04
func CreateUniqueDirectory ¶ added in v1.0.2
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 ¶ added in v1.3.336
DeleteDirContents removes all the contents of the given directory
func DeleteFile ¶ added in v1.3.50
func DiffSlices ¶ added in v1.3.249
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 ¶ added in v1.0.6
Download a file from the given URL
func EnvironmentsDir ¶ added in v1.0.6
func FileExists ¶
func FirstNotEmptyString ¶ added in v1.0.26
FirstNotEmptyString returns the first non empty string or the empty string if none can be found
func FormatDate ¶ added in v1.3.30
func GetColor ¶ added in v1.3.49
GetColor returns the color for the list of colour names and option name
func GetLatestVersionFromGitHub ¶ added in v1.0.6
func GetLatestVersionStringFromGitHub ¶ added in v1.3.57
func GetMockAPIResponseFromFile ¶ added in v1.1.43
@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 ¶ added in v1.0.2
func InvalidArgError ¶ added in v1.0.2
func InvalidArgf ¶ added in v1.0.2
func InvalidOption ¶ added in v1.0.2
func InvalidOptionError ¶ added in v1.0.2
func InvalidOptionf ¶ added in v1.0.2
func JXBinLocation ¶ added in v1.3.189
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 ¶ added in v1.3.189
JXBinaryLocation Returns the path to the currently installed JX binary.
func LoadCacheData ¶ added in v1.0.2
func LoadCacheData(fileName string, loader CacheLoader) ([]byte, error)
LoadCacheData loads cached data from the given cache file name and loader
func MarkdownLink ¶ added in v1.1.67
MarkdownLink returns a markdown link
func MavenBinaryLocation ¶ added in v1.3.28
func MissingOption ¶ added in v1.0.54
func OrganisationsDir ¶ added in v1.3.29
func PathWithBinary ¶ added in v1.2.122
PathWithBinary Sets the $PATH variable. Accepts an optional slice of strings containing paths to add to $PATH
func PickName ¶ added in v1.0.10
func PickName(names []string, message string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
func PickNameWithDefault ¶ added in v1.0.10
func PickNames ¶ added in v1.0.10
func PickNames(names []string, message string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) ([]string, error)
func PickPassword ¶ added in v1.1.48
func PickPassword(message string, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) (string, error)
func PickRequiredNameWithDefault ¶ added in v1.1.15
func PomFlavour ¶ added in v1.3.49
func RandStringBytesMaskImprSrc ¶ added in v1.3.93
RandStringBytesMaskImprSrc returns a random hexadecimal string of length n.
func RecreateDirs ¶ added in v1.3.336
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 RenameFile ¶ added in v1.1.14
func ReverseStrings ¶ added in v1.0.69
func ReverseStrings(a []string)
func SelectNames ¶ added in v1.0.119
func SelectNames(names []string, message string, selectAll bool, in terminal.FileReader, out terminal.FileWriter, outErr io.Writer) ([]string, error)
SelectNames select which names from the list should be chosen
func SelectNamesWithFilter ¶ added in v1.2.39
func SelectNamesWithFilter(names []string, message string, selectAll bool, filter 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 SortedMapKeys ¶ added in v1.0.54
SortedMapKeys returns the sorted keys of the given map
func StringArrayIndex ¶ added in v1.0.2
func StringArrayToLower ¶ added in v1.1.4
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 ¶ added in v1.2.141
StringMapHasValue returns true if the given map contains the given value
func StringMatchesAny ¶ added in v1.2.84
StringMatches returns true if the given text matches the includes/excludes lists
func StringMatchesPattern ¶ added in v1.2.84
StringMatchesPattern returns true if the given text matches the includes/excludes lists
func SuggestionsFor ¶ added in v1.0.2
func ToStringMapStringFromStruct ¶ added in v1.3.242
ToStringMapStringFromStruct returns string[map]string from any struct. Use structs tag to change map keys. e.g. ServerName string `structs:"server_name"`
func UnTargz ¶ added in v1.0.6
untargz a tarball to a target, from http://blog.ralch.com/tutorial/golang-working-with-tar-and-gzipf
func UrlHostNameWithoutPort ¶ added in v1.2.137
UrlHostNameWithoutPort returns the host name without any port of the given URL like string
Types ¶
type CacheLoader ¶ added in v1.0.2
type Command ¶ added in v1.3.106
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) Attempts ¶ added in v1.3.106
Attempts The number of times the command has been executed
func (*Command) DidError ¶ added in v1.3.106
DidError returns a boolean if any error occurred in any execution of the command
func (*Command) DidFail ¶ added in v1.3.106
DidFail returns a boolean if the command could not complete (errored on every attempt)
func (*Command) RunWithoutRetry ¶ added in v1.3.106
RunWithoutRetry Execute the command without retrying on failure and block waiting for return values
func (*Command) SetArgs ¶ added in v1.3.189
SetArgs Setter method for Args to enable use of interface instead of Command struct
func (*Command) SetDir ¶ added in v1.3.189
SetDir Setter method for Dir to enable use of interface instead of Command struct
func (*Command) SetExponentialBackOff ¶ added in v1.3.189
func (c *Command) SetExponentialBackOff(backoff *backoff.ExponentialBackOff)
SetExponentialBackOff Setter method for ExponentialBackOff to enable use of interface instead of Command struct
func (*Command) SetName ¶ added in v1.3.189
SetName Setter method for Name to enable use of interface instead of Command struct
func (*Command) SetTimeout ¶ added in v1.3.189
SetTimeout Setter method for Timeout to enable use of interface instead of Command struct
type Commander ¶ added in v1.3.262
type Commander 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) }
Commander defines the interface for a Command