Documentation ¶
Index ¶
- Constants
- func All(vs []interface{}, f func(interface{}) bool) bool
- func Any(vs []interface{}, f func(interface{}) bool) bool
- func AssertNoErrorPanic(err error, lines ...string)
- func AssertNoErrorPanicF(err error, format string, args ...interface{})
- func AssertOrPanic(condition bool, lines ...string)
- func AssertOrPanicF(condition bool, format string, args ...interface{})
- func Chmod(filePath string, mode os.FileMode) error
- func CombineErrors(err error, errs ...error) error
- func ContainsDotFile(p string) bool
- func CopyFileOrDirectory(src string, dest string) error
- func CopyFileWithBackup(src string, dst string, backupDir string, doMoveInstead bool) (err error)
- func DebugAssert(condition bool, lines ...string)
- func DebugAssertF(condition bool, format string, args ...interface{})
- func DebugAssertNoError(err error, lines ...string)
- func DebugAssertNoErrorF(err error, format string, args ...interface{})
- func Error(lines ...string) error
- func ErrorF(format string, args ...interface{}) error
- func ExtractTarGz(gzipStream io.Reader, baseDir string) (paths []string, err error)
- func ExtractZip(zipFile io.ReaderAt, zipFileSize int64, destDir string) (paths []string, err error)
- func Filter(vs []interface{}, f func(interface{}) bool) []interface{}
- func FormatError(err error) string
- func FormatMessage(suffix string, indent string, lines ...string) string
- func FormatMessageF(suffix string, indent string, format string, args ...interface{}) string
- func GetAllFiles(root string) (files []string, err error)
- func GetCombinedOutputFromExecutable(ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) ([]byte, error)
- func GetCtty() (*os.File, error)
- func GetDuration(since time.Duration) time.Duration
- func GetFiles(root string, filter FileFilter) (files []string, err error)
- func GetOutputFromExecutable(ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) ([]byte, error)
- func GetOutputFromExecutableSep(ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) ([]byte, []byte, error)
- func GetOutputFromExecutableTrimmed(ctx IExecContext, exe IExecutable, ...) (string, error)
- func GetProgressBar(log ILogContext, title string, length int) (bar *pb.ProgressBar)
- func GetSHA1Hash(reader io.Reader) (string, error)
- func GetSHA1HashFile(path string) (sha string, err error)
- func GetSHA256Hash(reader io.Reader) (string, error)
- func GetStartTime() time.Duration
- func GetTempPath(dir string, postfix string) (file string)
- func Glob(pattern string, ignoreErrors bool) (l []string, err error)
- func GlobMatch(pattern string, path string) (bool, error)
- func HandleCLIErrors(err interface{}, cwd string, log ILogContext, ...) bool
- func IsDirectory(path string) bool
- func IsExecutable(path string) bool
- func IsFile(path string) bool
- func IsPathError(err error) bool
- func IsPathExisting(path string) (bool, error)
- func IsWritable(path string) bool
- func LoadJSON(file string, repr interface{}) error
- func LoadYAML(file string, repr interface{}) error
- func MakeExecutable(path string) (err error)
- func MakeRelative(base string, path string) (s string, e error)
- func Map(vs []interface{}, f func(interface{}) interface{}) []interface{}
- func MatchLineRegexInFile(filePath string, regex *regexp.Regexp) (found bool, err error)
- func Panic(lines ...string)
- func PanicF(format string, args ...interface{})
- func PanicIf(condition bool, lines ...string)
- func PanicIfF(condition bool, format string, args ...interface{})
- func ReadJSON(reader io.Reader, repr interface{}) error
- func ReplaceTilde(p string) (string, error)
- func ReplaceTildeWith(p string, repl string) string
- func RunExecutable(ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) error
- func SplitPath(p string) []string
- func StoreJSON(file string, repr interface{}) error
- func StoreYAML(file string, repr interface{}) error
- func ToErrorWriter(log ILogContext) io.Writer
- func ToInfoWriter(log ILogContext) io.Writer
- func TouchFile(filePath string, makeDirs bool) (err error)
- func VerifyFile(file io.Reader, signature io.Reader, publicKey string) error
- func WalkFiles(root string, filter FileFunc) error
- func WalkPaths(root string, filter FileFunc) error
- func WriteJSON(writer io.Writer, repr interface{}) error
- type CmdContext
- func (c *CmdContext) Check(args ...string) error
- func (c *CmdContext) CheckPiped(args ...string) error
- func (c *CmdContext) Get(args ...string) (string, error)
- func (c *CmdContext) GetCombined(args ...string) (string, error)
- func (c *CmdContext) GetExitCode(args ...string) (int, error)
- func (c *CmdContext) GetSplit(args ...string) ([]string, error)
- type ExecContext
- type Executable
- type FileFilter
- type FileFunc
- type GithooksFailure
- type IExecContext
- type IExecutable
- type ILogContext
- type ILogStats
- type ITask
- type LogContext
- func (c *LogContext) AssertNoError(err error, lines ...string) bool
- func (c *LogContext) AssertNoErrorF(err error, format string, args ...interface{}) bool
- func (c *LogContext) AssertNoErrorPanic(err error, lines ...string)
- func (c *LogContext) AssertNoErrorPanicF(err error, format string, args ...interface{})
- func (c *LogContext) AssertWarn(condition bool, lines ...string)
- func (c *LogContext) AssertWarnF(condition bool, format string, args ...interface{})
- func (c *LogContext) ColorError(s string) string
- func (c *LogContext) ColorInfo(s string) string
- func (c *LogContext) ColorPrompt(s string) string
- func (c *LogContext) Debug(lines ...string)
- func (c *LogContext) DebugF(format string, args ...interface{})
- func (c *LogContext) DebugIf(condition bool, lines ...string)
- func (c *LogContext) DebugIfF(condition bool, format string, args ...interface{})
- func (c *LogContext) DisableStats()
- func (c *LogContext) EnableStats()
- func (c *LogContext) Error(lines ...string)
- func (c *LogContext) ErrorCount() int
- func (c *LogContext) ErrorF(format string, args ...interface{})
- func (c *LogContext) ErrorIf(condition bool, lines ...string)
- func (c *LogContext) ErrorIfF(condition bool, format string, args ...interface{})
- func (c *LogContext) ErrorOrPanicF(isFatal bool, err error, format string, args ...interface{})
- func (c *LogContext) ErrorWithStacktrace(lines ...string)
- func (c *LogContext) ErrorWithStacktraceF(format string, args ...interface{})
- func (c *LogContext) GetErrorFormatter(withColor bool) func(format string, args ...interface{}) string
- func (c *LogContext) GetErrorWriter() io.Writer
- func (c *LogContext) GetIndent() string
- func (c *LogContext) GetInfoFormatter(withColor bool) func(format string, args ...interface{}) string
- func (c *LogContext) GetInfoWriter() io.Writer
- func (c *LogContext) GetPromptFormatter(withColor bool) func(format string, args ...interface{}) string
- func (c *LogContext) HasColors() bool
- func (c *LogContext) Info(lines ...string)
- func (c *LogContext) InfoF(format string, args ...interface{})
- func (c *LogContext) InfoIf(condition bool, lines ...string)
- func (c *LogContext) InfoIfF(condition bool, format string, args ...interface{})
- func (c *LogContext) IsErrorATerminal() bool
- func (c *LogContext) IsInfoATerminal() bool
- func (c *LogContext) Panic(lines ...string)
- func (c *LogContext) PanicF(format string, args ...interface{})
- func (c *LogContext) PanicIf(condition bool, lines ...string)
- func (c *LogContext) PanicIfF(condition bool, format string, args ...interface{})
- func (c *LogContext) ResetStats()
- func (c *LogContext) Warn(lines ...string)
- func (c *LogContext) WarnF(format string, args ...interface{})
- func (c *LogContext) WarnIf(condition bool, lines ...string)
- func (c *LogContext) WarnIfF(condition bool, format string, args ...interface{})
- func (c *LogContext) WarningCount() int
- type PipeSetupFunc
- type ProgressSettings
Constants ¶
const ( // IsDebug set to `true` will disable debug asserts and other stuff. IsDebug = false // DebugLog set to `true` will turn on debug logging. DebugLog = false )
const ( GithooksEmoji = "🦎" // ListItemLiteral is the list item used for CLI and other printing stuff. ListItemLiteral = "•" )
const ( // DefaultFileModeDirectory is the default file mod for directory creation. DefaultFileModeDirectory = os.FileMode(0775) // nolint:gomnd // DefaultFileModeFile is the default file mod for file creation. DefaultFileModeFile = os.FileMode(0664) // nolint:gomnd )
const WindowsExecutableSuffix = ".exe"
WindowsExecutableSuffix is the Windows executable suffix.
const WindowsOsName = "windows"
WindowsOsName is the Windows platform name.
Variables ¶
This section is empty.
Functions ¶
func AssertNoErrorPanic ¶
AssertNoErrorPanic Assert no error, otherwise panic.
func AssertNoErrorPanicF ¶
AssertNoErrorPanicF Assert no error, otherwise panic.
func AssertOrPanic ¶
AssertOrPanic Assert a condition is `true`, otherwise panic.
func AssertOrPanicF ¶
AssertOrPanicF Assert a condition is `true`, otherwise panic.
func CombineErrors ¶
CombineErrors combines multiple errors into one.
func ContainsDotFile ¶
ContainsDotFile checks if path `p` contains `.*` parts (dotfiles) in the path.
func CopyFileOrDirectory ¶
CopyFileOrDirectory copies a directory or file from `src` to `dest` replacing `dest` if it exists. Copies also symlinks.
func CopyFileWithBackup ¶
CopyFileWithBackup copies (if `!doMoveInstead`, otherwise moves) the contents of the file named `src` to the file named by `dst`. If `dst` already exists it will be force moved to `backupDir/dst`. Make sure that `backupDir` is on the same device as `dst` as otherwise this will fail! After this, any failure tries to recover as good as possible to not have touched/moved `dst`.
func DebugAssert ¶
DebugAssert asserts that a condition is `true`, otherwise panic (disabled in production mode).
func DebugAssertF ¶
DebugAssertF asserts that a condition is `true`, otherwise panic (disabled in production mode).
func DebugAssertNoError ¶
DebugAssertNoError asserts that a condition is `true`, otherwise panic (disabled in production mode).
func DebugAssertNoErrorF ¶
DebugAssertNoErrorF asserts that a condition is `true`, otherwise panic (disabled in production mode).
func ExtractTarGz ¶
ExtractTarGz extracts `.tar.gz` streams to `baseDir` which must not exist. Overwrites everything.
func ExtractZip ¶
ExtractZip will decompress a zip archive, moving all files and folders within the zip file in `src` to an output directory `dest`. Returns all file paths in the zip file.
func Filter ¶
func Filter(vs []interface{}, f func(interface{}) bool) []interface{}
Filter returns a new slice containing all strings in the slice that satisfy the predicate `f`.
func FormatMessage ¶
FormatMessage formats several lines with a suffix and indent.
func FormatMessageF ¶
FormatMessageF formats several lines with a suffix and indent.
func GetAllFiles ¶
GetAllFiles returns all the files in directory `root` (non-recursive).
func GetCombinedOutputFromExecutable ¶
func GetCombinedOutputFromExecutable( ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) ([]byte, error)
GetCombinedOutputFromExecutable calls an executable and returns its stdout and stderr output.
func GetDuration ¶
GetDuration gets the duration since a time `since`.
func GetFiles ¶
func GetFiles(root string, filter FileFilter) (files []string, err error)
GetFiles returns the filtered files in directory `root` (non-recursive). The nil Filter returns all files.
func GetOutputFromExecutable ¶
func GetOutputFromExecutable( ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) ([]byte, error)
GetOutputFromExecutable calls an executable and returns its stdout output.
func GetOutputFromExecutableSep ¶
func GetOutputFromExecutableSep( ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) ([]byte, []byte, error)
GetOutputFromExecutableSep calls an executable and gets stdout and stderr separate.
func GetOutputFromExecutableTrimmed ¶
func GetOutputFromExecutableTrimmed( ctx IExecContext, exe IExecutable, pipeSetup func() (io.Reader, io.Writer, io.Writer), args ...string) (string, error)
GetOutputFromExecutableTrimmed calls an executable and returns its trimmed stdout output.
func GetProgressBar ¶
func GetProgressBar(log ILogContext, title string, length int) (bar *pb.ProgressBar)
GetProgressBar returns a progressbar or nil (if log has no terminal attached).
func GetSHA1Hash ¶
GetSHA1Hash gets the SHA1 hash of a string.
func GetSHA1HashFile ¶
GetSHA1HashFile gets the SHA1 hash of a file. It properly mimics `git hash-file`.
func GetSHA256Hash ¶
GetSHA256Hash gets the SHA1 hash of a string.
func GetTempPath ¶
GetTempPath creates a random non-existing path with a postfix `postfix` in directory `dir` (can be empty to use the working dir).
func Glob ¶
Glob adds double-star support to the core path/filepath Glob function. It's useful when your globs might have double-stars, but you're not sure. On Windows `\\` or '/' will work as a path separator in pattern. Adpated for syntax escaping and only "/" paths in output. Package 'doublestar/v3' is awefully slow.
func HandleCLIErrors ¶
func HandleCLIErrors( err interface{}, cwd string, log ILogContext, getBugReportingInfo func(string) (string, error)) bool
HandleCLIErrors generally handles errors for the Githooks executables. Argument `cwd` can be empty.
func IsDirectory ¶
IsDirectory checks if a path is a existing directory.
func IsExecutable ¶
IsExecutable checks if the path is executable by the current user.
func IsPathError ¶
IsPathError returns `true` if the error is a `os.PathError`.
func IsPathExisting ¶
IsPathExisting checks if a path exists.
func IsWritable ¶
IsWritable checks if the path is writable by the current user.
func MakeExecutable ¶
MakeExecutable makes a file executable.
func MakeRelative ¶
MakeRelative makes a `path` relative to `base`.
func Map ¶
func Map(vs []interface{}, f func(interface{}) interface{}) []interface{}
Map returns a new slice containing the results of applying the function `f` to each string in the original slice.
func MatchLineRegexInFile ¶
MatchLineRegexInFile returns if the regex matches in the file `filePath`.
func ReplaceTilde ¶
ReplaceTilde replaces a prefix tilde '~' character in a path with the home dir.
func ReplaceTildeWith ¶
ReplaceTildeWith replaces a prefix tilde '~' character in a path with the string `repl`.
func RunExecutable ¶
func RunExecutable( ctx IExecContext, exe IExecutable, pipeSetup PipeSetupFunc, args ...string) error
RunExecutable calls an executable.
func ToErrorWriter ¶
func ToErrorWriter(log ILogContext) io.Writer
ToErrorWriter wrapps the log context error into a `io.Writer`.
func ToInfoWriter ¶
func ToInfoWriter(log ILogContext) io.Writer
ToInfoWriter wrapps the log context info into a `io.Writer`.
func VerifyFile ¶
VerifyFile verifies an input `file` with its `signature` provided a public GPG kex in hex format.
Types ¶
type CmdContext ¶
CmdContext defines the command context to execute commands.
func (*CmdContext) Check ¶
func (c *CmdContext) Check(args ...string) error
Check checks if a command executed successfully.
func (*CmdContext) CheckPiped ¶
func (c *CmdContext) CheckPiped(args ...string) error
CheckPiped checks if a command executed successfully.
func (*CmdContext) Get ¶
func (c *CmdContext) Get(args ...string) (string, error)
Get executes a command and gets the stdout.
func (*CmdContext) GetCombined ¶
func (c *CmdContext) GetCombined(args ...string) (string, error)
GetCombined executes a command and gets the combined stdout and stderr.
func (*CmdContext) GetExitCode ¶
func (c *CmdContext) GetExitCode(args ...string) (int, error)
GetExitCode get the exit code of the command.
type ExecContext ¶
ExecContext defines a context to execute commands.
func (*ExecContext) GetEnv ¶
func (c *ExecContext) GetEnv() []string
GetEnv gets the environement variables.
func (*ExecContext) GetWorkingDir ¶
func (c *ExecContext) GetWorkingDir() string
GetWorkingDir gets the working dir.
type Executable ¶
type Executable struct { // The absolute path of the hook script/executable. Cmd string // Arguments to the hook script/executable. Args []string }
Executable contains the data to a script/executable file.
func (*Executable) GetArgs ¶
func (e *Executable) GetArgs(args ...string) []string
GetArgs gets all args.
func (*Executable) GetCommand ¶
func (e *Executable) GetCommand() string
GetCommand gets the first command.
type FileFilter ¶
FileFilter is the filter for `GetFiles`.
type GithooksFailure ¶
type GithooksFailure struct {
// contains filtered or unexported fields
}
GithooksFailure is a normal hook failure.
func (*GithooksFailure) Error ¶
func (e *GithooksFailure) Error() string
type IExecContext ¶
IExecContext defines the context interface to execute commands.
type IExecutable ¶
type IExecutable interface { GetCommand() string GetArgs(args ...string) []string GetString() string }
IExecutable defines the interface for a general executable.
type ILogContext ¶
type ILogContext interface { // Log functions Debug(lines ...string) DebugF(format string, args ...interface{}) Info(lines ...string) InfoF(format string, args ...interface{}) Warn(lines ...string) WarnF(format string, args ...interface{}) Error(lines ...string) ErrorF(format string, args ...interface{}) ErrorWithStacktrace(lines ...string) ErrorWithStacktraceF(format string, args ...interface{}) Panic(lines ...string) PanicF(format string, args ...interface{}) // Assert helper functions ErrorOrPanicF(isFatal bool, err error, format string, args ...interface{}) AssertWarn(condition bool, lines ...string) AssertWarnF(condition bool, format string, args ...interface{}) DebugIf(condition bool, lines ...string) DebugIfF(condition bool, format string, args ...interface{}) InfoIf(condition bool, lines ...string) InfoIfF(condition bool, format string, args ...interface{}) WarnIf(condition bool, lines ...string) WarnIfF(condition bool, format string, args ...interface{}) ErrorIf(condition bool, lines ...string) ErrorIfF(condition bool, format string, args ...interface{}) PanicIf(condition bool, lines ...string) PanicIfF(condition bool, format string, args ...interface{}) AssertNoError(err error, lines ...string) bool AssertNoErrorF(err error, format string, args ...interface{}) bool AssertNoErrorPanic(err error, lines ...string) AssertNoErrorPanicF(err error, format string, args ...interface{}) HasColors() bool ColorInfo(string) string ColorError(string) string ColorPrompt(string) string GetIndent() string GetInfoFormatter(withColor bool) func(format string, args ...interface{}) string GetErrorFormatter(withColor bool) func(format string, args ...interface{}) string GetPromptFormatter(withColor bool) func(format string, args ...interface{}) string GetInfoWriter() io.Writer IsInfoATerminal() bool GetErrorWriter() io.Writer IsErrorATerminal() bool }
ILogContext defines the log interface.
type ILogStats ¶
type ILogStats interface { ErrorCount() int WarningCount() int ResetStats() EnableStats() DisableStats() }
ILogStats is an interface for log statistics.
type ITask ¶
ITask is a background task which can be run with `RunBackgroundTask`. The exit channel `exitCh` can be used to signal an early exit of the running task if it supports early termination.
func RunTaskWithProgress ¶
func RunTaskWithProgress( taskIn ITask, log ILogContext, timeout time.Duration, sett ProgressSettings) (taskOut ITask, taskError error)
RunTaskWithProgress runs a task with a progress spinner (if available) in a coroutine. The returned task `taskOut` contains the output of the run. If the task timed out, it will be `nil`.
type LogContext ¶
type LogContext struct {
// contains filtered or unexported fields
}
LogContext defines the data for a log context.
func CreateLogContext ¶
func CreateLogContext(onlyStderr bool) (*LogContext, error)
CreateLogContext creates a log context.
func (*LogContext) AssertNoError ¶
func (c *LogContext) AssertNoError(err error, lines ...string) bool
AssertNoError Assert no error, and otherwise log it.
func (*LogContext) AssertNoErrorF ¶
func (c *LogContext) AssertNoErrorF(err error, format string, args ...interface{}) bool
AssertNoErrorF Assert no error, and otherwise log it.
func (*LogContext) AssertNoErrorPanic ¶
func (c *LogContext) AssertNoErrorPanic(err error, lines ...string)
AssertNoErrorPanic asserts no error, and otherwise log and panic.
func (*LogContext) AssertNoErrorPanicF ¶
func (c *LogContext) AssertNoErrorPanicF(err error, format string, args ...interface{})
AssertNoErrorPanicF asserts no error, and otherwise log and panic.
func (*LogContext) AssertWarn ¶
func (c *LogContext) AssertWarn(condition bool, lines ...string)
AssertWarn Assert a condition is `true`, otherwise log.
func (*LogContext) AssertWarnF ¶
func (c *LogContext) AssertWarnF(condition bool, format string, args ...interface{})
AssertWarnF Assert a condition is `true`, otherwise log.
func (*LogContext) ColorError ¶
func (c *LogContext) ColorError(s string) string
ColorError returns the colorized string for error-like messages.
func (*LogContext) ColorInfo ¶
func (c *LogContext) ColorInfo(s string) string
ColorInfo returns the colorized string for info-like messages.
func (*LogContext) ColorPrompt ¶
func (c *LogContext) ColorPrompt(s string) string
ColorPrompt returns the colorized string for prompt-like messages.
func (*LogContext) DebugF ¶
func (c *LogContext) DebugF(format string, args ...interface{})
DebugF logs a debug message.
func (*LogContext) DebugIf ¶
func (c *LogContext) DebugIf(condition bool, lines ...string)
DebugIf Assert a condition is `true`, otherwise log.
func (*LogContext) DebugIfF ¶
func (c *LogContext) DebugIfF(condition bool, format string, args ...interface{})
DebugIfF Assert a condition is `true`, otherwise log.
func (*LogContext) DisableStats ¶
func (c *LogContext) DisableStats()
DisableStats disables the log statistics.
func (*LogContext) EnableStats ¶
func (c *LogContext) EnableStats()
EnableStats enables the log statistics.
func (*LogContext) ErrorCount ¶
func (c *LogContext) ErrorCount() int
ErrorCount gets the number of logged errors.
func (*LogContext) ErrorF ¶
func (c *LogContext) ErrorF(format string, args ...interface{})
ErrorF logs an error.
func (*LogContext) ErrorIf ¶
func (c *LogContext) ErrorIf(condition bool, lines ...string)
ErrorIf Assert a condition is `true`, otherwise log.
func (*LogContext) ErrorIfF ¶
func (c *LogContext) ErrorIfF(condition bool, format string, args ...interface{})
ErrorIfF Assert a condition is `true`, otherwise log.
func (*LogContext) ErrorOrPanicF ¶
func (c *LogContext) ErrorOrPanicF(isFatal bool, err error, format string, args ...interface{})
ErrorOrPanicF logs an error or a fatal error and also with a potential occurred error.
func (*LogContext) ErrorWithStacktrace ¶
func (c *LogContext) ErrorWithStacktrace(lines ...string)
ErrorWithStacktrace logs and error with the stack trace.
func (*LogContext) ErrorWithStacktraceF ¶
func (c *LogContext) ErrorWithStacktraceF(format string, args ...interface{})
ErrorWithStacktraceF logs and error with the stack trace.
func (*LogContext) GetErrorFormatter ¶
func (c *LogContext) GetErrorFormatter(withColor bool) func(format string, args ...interface{}) string
GetErrorFormatter formats an error.
func (*LogContext) GetErrorWriter ¶
func (c *LogContext) GetErrorWriter() io.Writer
GetErrorWriter returns the error writer.
func (*LogContext) GetIndent ¶
func (c *LogContext) GetIndent() string
GetIndent returns the used indent.
func (*LogContext) GetInfoFormatter ¶
func (c *LogContext) GetInfoFormatter(withColor bool) func(format string, args ...interface{}) string
GetInfoFormatter formats an info.
func (*LogContext) GetInfoWriter ¶
func (c *LogContext) GetInfoWriter() io.Writer
GetInfoWriter returns the info writer.
func (*LogContext) GetPromptFormatter ¶
func (c *LogContext) GetPromptFormatter(withColor bool) func(format string, args ...interface{}) string
GetPromptFormatter formats a prompt.
func (*LogContext) HasColors ¶
func (c *LogContext) HasColors() bool
HasColors returns if the log uses colors.
func (*LogContext) InfoF ¶
func (c *LogContext) InfoF(format string, args ...interface{})
InfoF logs a info message.
func (*LogContext) InfoIf ¶
func (c *LogContext) InfoIf(condition bool, lines ...string)
InfoIf Assert a condition is `true`, otherwise log.
func (*LogContext) InfoIfF ¶
func (c *LogContext) InfoIfF(condition bool, format string, args ...interface{})
InfoIfF Assert a condition is `true`, otherwise log.
func (*LogContext) IsErrorATerminal ¶
func (c *LogContext) IsErrorATerminal() bool
IsErrorATerminal returns `true` if the error log is connected to a terminal.
func (*LogContext) IsInfoATerminal ¶
func (c *LogContext) IsInfoATerminal() bool
IsInfoATerminal returns `true` if the info log is connected to a terminal.
func (*LogContext) Panic ¶
func (c *LogContext) Panic(lines ...string)
Panic logs an error and calls panic with a GithooksFailure.
func (*LogContext) PanicF ¶
func (c *LogContext) PanicF(format string, args ...interface{})
PanicF logs an error and calls panic with a GithooksFailure.
func (*LogContext) PanicIf ¶
func (c *LogContext) PanicIf(condition bool, lines ...string)
PanicIf Assert a condition is `true`, otherwise log it.
func (*LogContext) PanicIfF ¶
func (c *LogContext) PanicIfF(condition bool, format string, args ...interface{})
PanicIfF Assert a condition is `true`, otherwise log it.
func (*LogContext) ResetStats ¶
func (c *LogContext) ResetStats()
ResetStats resets the log statistics.
func (*LogContext) WarnF ¶
func (c *LogContext) WarnF(format string, args ...interface{})
WarnF logs a warning message.
func (*LogContext) WarnIf ¶
func (c *LogContext) WarnIf(condition bool, lines ...string)
WarnIf Assert a condition is `true`, otherwise log.
func (*LogContext) WarnIfF ¶
func (c *LogContext) WarnIfF(condition bool, format string, args ...interface{})
WarnIfF Assert a condition is `true`, otherwise log.
func (*LogContext) WarningCount ¶
func (c *LogContext) WarningCount() int
WarningCount gets the number of logged warnings.
type PipeSetupFunc ¶
PipeSetupFunc is the setup function for the pipes executed by the below execution calls.
func UseOnlyStdin ¶
func UseOnlyStdin(inPipe io.Reader) PipeSetupFunc
UseOnlyStdin returns a pipe setup function which pipes stdin.
func UseStdStreams ¶
func UseStdStreams(pipeStdin bool, pipeStdOut bool, pipeStderr bool) PipeSetupFunc
UseStdStreams returns a pipe setup function which pipes to the standard in/out/err streams.
func UseStreams ¶
UseStreams returns a pipe setup function which pipes everything.
type ProgressSettings ¶
type ProgressSettings struct { Title string TitleStillRunning string ProgressUpdateInterval time.Duration ProgressStillRunningAfter time.Duration }
ProgressSettings defines the settings for the progress spinner for `RunTaskWithProgress`.
func CreateDefaultProgressSettings ¶
func CreateDefaultProgressSettings(title string, titleStillRunning string) ProgressSettings
CreateDefaultProgressSettings creates default progressbar settings.