Documentation
¶
Index ¶
- Variables
- func ColorAnswer(in string) string
- func ColorError(in string) string
- func ColorInfo(in string) string
- func ColorWarning(in string) string
- func ConfigDir() string
- func CopyDir(src string, dst string, force bool) error
- func CopyFile(src, dst string) error
- func CreateConfigPath(configPath, configFile string) *string
- func DxBinaryLocation() (string, error)
- func DxConfigFile() string
- func FileExists(path string) (bool, error)
- func GetColor(optionName string, colorNames []string) (*color.Color, error)
- func GhConfigDir() string
- func HomeDir() string
- func ReadFile(fn string) ([]byte, error)
- func SafeIfAboveZero(number int) string
- func SafeTime(in *time.Time) string
- func Strip(str string) string
- func TrimTemplate(instanceTemplate string, instanceType string) string
- 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) 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) String() string
- type CommandError
- type CommandRunner
- type DefaultCommandRunner
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var ( InfoColor = "\033[1;32m%s\033[0m" WarningColor = "\033[1;33m%s\033[0m" StatusColor = "\033[1;34m%s\033[0m" ErrorColor = "\033[1;31m%s\033[0m" )
Functions ¶
func ColorAnswer ¶
ColorAnswer returns a new function that returns status-colorized (blue) strings for the given arguments with fmt.Sprint().
func ColorError ¶
ColorError returns a new function that returns error-colorized (red) strings for the given arguments with fmt.Sprint().
func ColorInfo ¶
ColorInfo returns a new function that returns info-colorized (green) strings for the given arguments with fmt.Sprint().
func ColorWarning ¶
ColorWarning returns a new function that returns warning-colorized (yellow) strings for the given arguments with fmt.Sprint().
func CreateConfigPath ¶
func DxBinaryLocation ¶
func DxConfigFile ¶
func DxConfigFile() string
func FileExists ¶
FileExists checks if path exists and is a file.
func GhConfigDir ¶
func GhConfigDir() string
func SafeIfAboveZero ¶
func TrimTemplate ¶
Types ¶
type Command ¶
type Command struct { Errors []error Dir string Name string Args []string 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) 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.
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 CommandRunner ¶
CommandRunner interface that wraps the RunWithoutRetry function.
type DefaultCommandRunner ¶
type DefaultCommandRunner struct { }
func (DefaultCommandRunner) RunWithoutRetry ¶
func (d DefaultCommandRunner) RunWithoutRetry(c *Command) (string, error)
RunWithoutRetry Execute the command without retrying on failure and block waiting for return values.
type Tracer ¶
type Tracer struct {
http.RoundTripper
}
Tracer implements http.RoundTripper. It prints each request and response/error to os.Stderr.