Documentation
¶
Index ¶
- Variables
- func CleanPath(path string) (err error)
- func Config(conf config.Config) afero.Fs
- func ConfigFileSystem()
- func Create(filename string) (afero.File, error)
- func DebugDiffString(l, r string)
- func DebugDiffStrings(l, r []string)
- func DebugDump(obj interface{})
- func DebugDumpDiff(left interface{}, right interface{})
- func DebugDumpDiffDetail(left interface{}, right interface{}, leftTitle, rightTitle string)
- func DeleteFile(filename string) error
- func DirExists(path string) (bool, error)
- func ErrorCheck(err error) bool
- func ErrorCheckf(err error, format string, context ...interface{}) bool
- func FileExists(path string) (bool, error)
- func LogAlert(alert ...interface{})
- func LogAlertf(format string, alert ...interface{})
- func LogAttention(info ...interface{})
- func LogAttentionf(format string, info ...interface{})
- func LogColour(out string, attr color.Attribute)
- func LogCyan(out string)
- func LogError(err ...interface{})
- func LogErrorf(format string, err ...interface{})
- func LogFatal(code int, err ...interface{})
- func LogGreen(out string)
- func LogInfo(info ...interface{})
- func LogInfof(format string, info ...interface{})
- func LogMagenta(out string)
- func LogOk(info ...interface{})
- func LogOkf(format string, info ...interface{})
- func LogRed(out string)
- func LogRedBright(out string)
- func LogWarn(warn ...interface{})
- func LogWarnf(format string, warn ...interface{})
- func LogWhite(out string)
- func LogYellow(out string)
- func Mkdir(path string, perm os.FileMode) error
- func Open(filename string) (afero.File, error)
- func PropertyIDGen(seed string) (hash string)
- func ReadAll(r io.Reader) ([]byte, error)
- func ReadDirAbsolute(path string, fileType string, recursive bool, files *[]string) (err error)
- func ReadDirRelative(path string, fileType string, recursive bool, files *[]string) (err error)
- func ReadFile(filename string) (data []byte, err error)
- func RecreateFolder(path string) (err error)
- func SelectAction(actionDesc string, options []string) (action string, err error)
- func SetConfigTesting()
- func SetLogFile(file string) func()
- func SetVerbose(v bool)
- func ShutdownFileSystem()
- func Stat(path string) (os.FileInfo, error)
- func StringInArray(a string, list []string) bool
- func VerboseOverrideRestore()
- func VerboseOverrideSet(ovr bool)
- func WorkingSubDir(subDir string) string
- func WriteFile(filename string, data []byte, perm os.FileMode) error
- type ExpectedCommand
- type Lambda
- type MockShellExecutor
- func (e MockShellExecutor) Count() int
- func (e *MockShellExecutor) ExpectExec(cmd string, args []string, output string, err error)
- func (e *MockShellExecutor) ExpectExecWithLambda(cmd string, args []string, output string, err error, lb Lambda)
- func (e *MockShellExecutor) ExpectationsWereMet() error
- func (e *MockShellExecutor) Run(cmd string, args ...string) (out string, err error)
- func (e *MockShellExecutor) SetPrefix(prefix string)
- type Params
- type ShellExecutor
- type ShellRunner
Constants ¶
This section is empty.
Variables ¶
var WorkingPathAbs string
WorkingPathAbs This is determined using the current working directory and the value of Config.Options.WorkingPath
Functions ¶
func ConfigFileSystem ¶
func ConfigFileSystem()
func DebugDiffStrings ¶
func DebugDiffStrings(l, r []string)
DebugDiffStrings Diff two arrays of strings
func DebugDumpDiff ¶
func DebugDumpDiff(left interface{}, right interface{})
DebugDumpDiff Pretty print differences between data structures
func DebugDumpDiffDetail ¶
func DebugDumpDiffDetail(left interface{}, right interface{}, leftTitle, rightTitle string)
DebugDumpDiffDetail Pretty print differences between data structures
func DeleteFile ¶
func ErrorCheck ¶
func ErrorCheckf ¶
func FileExists ¶
func LogAttention ¶
func LogAttention(info ...interface{})
func LogAttentionf ¶
func LogAttentionf(format string, info ...interface{})
func LogMagenta ¶
func LogMagenta(out string)
func LogRedBright ¶
func LogRedBright(out string)
func PropertyIDGen ¶
PropertyIDGen Generate an MD5 hash of the seed input data. If no seed is provided then the current unix timestamp is used
func ReadDirAbsolute ¶
func ReadDirRelative ¶
Recursively check the path for typetype files and add them to the schema list as we're going
func RecreateFolder ¶
func SelectAction ¶
SelectAction Generic function for a cli option selection prompt
func SetConfigTesting ¶
func SetConfigTesting()
SetConfigTesting Enable unit test file and command subsystems
func SetLogFile ¶
func SetLogFile(file string) func()
func SetVerbose ¶
func SetVerbose(v bool)
func ShutdownFileSystem ¶
func ShutdownFileSystem()
func StringInArray ¶
func VerboseOverrideRestore ¶
func VerboseOverrideRestore()
func VerboseOverrideSet ¶
func VerboseOverrideSet(ovr bool)
func WorkingSubDir ¶
Types ¶
type ExpectedCommand ¶
type ExpectedCommand struct { Cmd string Args []string Triggered bool // contains filtered or unexported fields }
ExpectedCommand Defines a mock command input and output
func (ExpectedCommand) Compare ¶
func (c ExpectedCommand) Compare(cmd string, args ...string) error
Compare Check if the input command matches this mock command
func (ExpectedCommand) GetResult ¶
func (c ExpectedCommand) GetResult(prefix string) string
GetResult Return the command result with the correct prefix
func (ExpectedCommand) Lambda ¶
func (c ExpectedCommand) Lambda() error
Lambda Execute simulated function
func (ExpectedCommand) String ¶
func (c ExpectedCommand) String() string
String String representation of the mock command
type MockShellExecutor ¶
type MockShellExecutor struct {
// contains filtered or unexported fields
}
MockShellExecutor A mock command executor that fulfills the Runner interface modelled after DATA-DOG/go-sqlmock
func (MockShellExecutor) Count ¶
func (e MockShellExecutor) Count() int
func (*MockShellExecutor) ExpectExec ¶
func (e *MockShellExecutor) ExpectExec(cmd string, args []string, output string, err error)
ExpectExec Create a expected command
func (*MockShellExecutor) ExpectExecWithLambda ¶
func (e *MockShellExecutor) ExpectExecWithLambda(cmd string, args []string, output string, err error, lb Lambda)
ExpectExecWithLambda Create a expected command
func (*MockShellExecutor) ExpectationsWereMet ¶
func (e *MockShellExecutor) ExpectationsWereMet() error
func (*MockShellExecutor) Run ¶
func (e *MockShellExecutor) Run(cmd string, args ...string) (out string, err error)
Run Execute a command. This function checks all expected commands for a match in order of creation and returns the expected output or error if found.
func (*MockShellExecutor) SetPrefix ¶
func (e *MockShellExecutor) SetPrefix(prefix string)
SetPrefix Set a prefix on the command output
type ShellExecutor ¶
type ShellExecutor struct {
// contains filtered or unexported fields
}
ShellExecutor Shell Command wrapper
func (ShellExecutor) Run ¶
func (e ShellExecutor) Run(command string, args ...string) (out string, err error)
Run executes a command with arguments. Both stdout and stderr are captured from the command and logged using the prefix defined in the shellPrefix parameter. The command output and any error is also returned. This function blocks until the shell command is complete.
func (*ShellExecutor) SetPrefix ¶
func (e *ShellExecutor) SetPrefix(prefix string)
SetPrefix Sets the prefix that will be used for console output
type ShellRunner ¶
ShellRunner An interface to abstract shell command structs