Documentation ¶
Index ¶
- Constants
- func ConfigDir() (string, error)
- func DeleteFile(fileName string) (err error)
- func FileExists(path string) (bool, error)
- func GenerateSchema(target interface{}) *schemagen.Schema
- func HomeDir() string
- func JXBinLocation() (string, error)
- func PathWithBinary(customPaths ...string) string
- func SanitizeURL(unsanitizedURL string) string
- func ToObjectMap(object interface{}) (map[string]interface{}, error)
- func ValidateYaml(target interface{}, data []byte) ([]string, error)
- 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) 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) SetName(name string)
- func (c *Command) SetTimeout(timeout time.Duration)
- func (c *Command) String() string
- type CommandError
Constants ¶
const (
DefaultWritePermissions = 0760
)
Variables ¶
This section is empty.
Functions ¶
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 FileExists ¶
FileExists checks if path exists and is a file
func GenerateSchema ¶
GenerateSchema generates a JSON schema for the given struct type and returns it.
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 PathWithBinary ¶
PathWithBinary Returns the path to be used to execute a binary from, takes the form JX_HOME/bin:mvnBinDir:customPaths
func SanitizeURL ¶
SanitizeURL sanitizes by stripping the user and password
func ToObjectMap ¶
ToObjectMap converts the given object into a map of strings/maps using YAML marshalling
func ValidateYaml ¶
ValidateYaml generates a JSON schema for the given struct type, and then validates the given YAML against that schema, ignoring Containers and missing fields.
Types ¶
type Command ¶
type Command struct { Errors []error Dir string Name string Args []string Timeout time.Duration Out io.Writer Err io.Writer In io.Reader 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 environment 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) 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) Cause ¶
func (c CommandError) Cause() error
func (CommandError) Error ¶
func (c CommandError) Error() string