asciichgolangpublic

package module
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

asciichgolangpublic

This module helps to write infrastructure and/or automation related microservices and CLIs easier and faster. By providing a lot of convenience functions, sanity checks during runtime and detailed error messages it can be used to write easy to understand software to automate repeatable work. The focus is on ease of use and developer speed instead of algorithm speed and computer resource efficiency.

Logging

To provide easy readable CLI output its recommended to use the provided logging functions:

package main

import "github.com/asciich/asciichgolangpublic"

func main() {
	asciichgolangpublic.LogInfo("Shown without additional color.")
	asciichgolangpublic.LogInfof("Shown without additional color. %s", "Also available with formatting.")

	asciichgolangpublic.LogGood("Good messages are green.")
	asciichgolangpublic.LogGoodf("Good messages are green. %s", "Also available with formatting.")

	asciichgolangpublic.LogChanged("Changes are purple.")
	asciichgolangpublic.LogChangedf("Changes are purple. %s", "Also available with formatting.")

	asciichgolangpublic.LogWarn("Warnings are yellow.")
	asciichgolangpublic.LogWarnf("Warnings are yellow. %s", "Also available with formatting.")

	asciichgolangpublic.LogError("Errors are red.")
	asciichgolangpublic.LogErrorf("Errors are red. %s", "Also available with formatting.")

	asciichgolangpublic.LogFatalf("Fatal will exit with a red error message and exit code %d", 1)
}

Output produced by this example code:

Errors

It's recommended to use TracedError whenever an error occurs with a custom error message. Error wrapping by directly passing errors or using the %w format string in TracedErrorf is supported. TracedErrors give you a nice debug output including the stack trace in a human readable form compatiple to VSCode (affected sources can directly be opened from Terminal).

Example usage:

func inThisFunctionSomethingGoesWrong() (err error) {
    return asciichgolangpublic.TracedError("This is an error message") // Use TracedErrors when an error occures.
}

err = inThisFunctionSomethingGoesWrong()
asciichgolangpublic.Errors().IsTracedError(err) // returns true for all TracedErrors.
asciichgolangpublic.Errors().IsTracedError(fmt.Errorf("another error")) // returns false for all non TracedErrors.

err.Error() // includes the error message and the stack trace as human readable text.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTracedError = errors.New("asciichgolangpublic TracedError base")
View Source
var ErrTracedErrorEmptyString = errors.New("asciichgolangpublic TracedError empty string")
View Source
var ErrTracedErrorNil = errors.New("asciichgolangpublic TracedError nil")
View Source
var ErrTracedErrorNotImplemented = errors.New("asciichgolangpublic TracedError not implemented")

Functions

func Log

func Log(logmessage string)

func LogBold

func LogBold(logmessage string)

func LogChanged

func LogChanged(logmessage string)

func LogChangedf

func LogChangedf(logmessage string, args ...interface{})

func LogError

func LogError(logmessage string)

func LogErrorf

func LogErrorf(logmessage string, args ...interface{})

func LogFatal

func LogFatal(logmessage string)

func LogFatalWithTrace

func LogFatalWithTrace(errorMessageOrError interface{})

func LogFatalWithTracef

func LogFatalWithTracef(logmessage string, args ...interface{})

func LogFatalf

func LogFatalf(logmessage string, args ...interface{})

func LogGoError

func LogGoError(err error)

func LogGoErrorFatal

func LogGoErrorFatal(err error)

func LogGoErrorFatalWithTrace

func LogGoErrorFatalWithTrace(err error)

func LogGood

func LogGood(logmessage string)

func LogGoodf

func LogGoodf(logmessage string, args ...interface{})

func LogInfo

func LogInfo(logmessage string)

func LogInfof

func LogInfof(logmessage string, args ...interface{})

func LogTurnOfColorOutput added in v0.7.1

func LogTurnOfColorOutput()

func LogTurnOnColorOutput added in v0.7.1

func LogTurnOnColorOutput()

func LogWarn

func LogWarn(logmessage string)

func LogWarnf

func LogWarnf(logmessage string, args ...interface{})

func MustFormatAsTestname

func MustFormatAsTestname(objectToFormat interface{}) (testname string)

func TracedError

func TracedError(errorMessageOrError interface{}) (tracedError error)

Create a new error with given error or error message. TracedErrors extends the error message by a human readable stack trace.

func TracedErrorEmptyString

func TracedErrorEmptyString(stringVarName string, errorToUnwrap ...error) (tracedError error)

func TracedErrorNil

func TracedErrorNil(nilVarName string) (tracedError error)

func TracedErrorNilf

func TracedErrorNilf(formatString string, args ...interface{}) (tracedError error)

func TracedErrorNotImplemented

func TracedErrorNotImplemented() (tracedError error)

func TracedErrorf

func TracedErrorf(formatString string, args ...interface{}) (tracedError error)

Create a new error with given error or error message. TracedErrors extends the error message by a human readable stack trace. Error wrapping using '%w' in format string is supported.

Types

type BashService added in v0.4.0

type BashService struct {
	CommandExecutorBase
}

func Bash added in v0.4.0

func Bash() (b *BashService)

func NewBashService added in v0.4.0

func NewBashService() (b *BashService)

func (*BashService) MustRunCommand added in v0.4.0

func (b *BashService) MustRunCommand(options *RunCommandOptions) (commandOutput *CommandOutput)

func (*BashService) RunCommand added in v0.4.0

func (b *BashService) RunCommand(options *RunCommandOptions) (commandOutput *CommandOutput, err error)

type ChecksumsService added in v0.1.4

type ChecksumsService struct {
}

func Checksums added in v0.1.4

func Checksums() (checksums *ChecksumsService)

func NewChecksumsService added in v0.1.4

func NewChecksumsService() (c *ChecksumsService)

func (*ChecksumsService) GetSha256SumFromString added in v0.1.4

func (c *ChecksumsService) GetSha256SumFromString(stringToHash string) (checksum string)

type CommandExecutor added in v0.4.0

type CommandExecutor interface {
	RunCommand(options *RunCommandOptions) (commandOutput *CommandOutput, err error)
	MustRunCommand(options *RunCommandOptions) (commandOutput *CommandOutput)

	// These Commands can be implemented by embedding the `CommandExecutorBase` struct:
	MustRunCommandAndGetStdoutAsBytes(options *RunCommandOptions) (stdout []byte)
	MustRunCommandAndGetStdoutAsFloat64(options *RunCommandOptions) (stdout float64)
	MustRunCommandAndGetStdoutAsLines(options *RunCommandOptions) (stdoutLines []string)
	MustRunCommandAndGetStdoutAsString(options *RunCommandOptions) (stdout string)
	RunCommandAndGetStdoutAsBytes(options *RunCommandOptions) (stdout []byte, err error)
	RunCommandAndGetStdoutAsFloat64(options *RunCommandOptions) (stdout float64, err error)
	RunCommandAndGetStdoutAsLines(options *RunCommandOptions) (stdoutLines []string, err error)
	RunCommandAndGetStdoutAsString(options *RunCommandOptions) (stdout string, err error)
}

A CommandExecutor is able to run a command like Exec or bash.

type CommandExecutorBase added in v0.4.0

type CommandExecutorBase struct {
	// contains filtered or unexported fields
}

func NewCommandExecutorBase added in v0.4.0

func NewCommandExecutorBase() (c *CommandExecutorBase)

func (*CommandExecutorBase) GetParentCommandExecutorForBaseClass added in v0.4.0

func (c *CommandExecutorBase) GetParentCommandExecutorForBaseClass() (parentCommandExecutorForBaseClass CommandExecutor, err error)

func (*CommandExecutorBase) MustGetParentCommandExecutorForBaseClass added in v0.4.0

func (c *CommandExecutorBase) MustGetParentCommandExecutorForBaseClass() (parentCommandExecutorForBaseClass CommandExecutor)

func (*CommandExecutorBase) MustRunCommandAndGetStdoutAsBytes added in v0.4.0

func (c *CommandExecutorBase) MustRunCommandAndGetStdoutAsBytes(options *RunCommandOptions) (stdout []byte)

func (*CommandExecutorBase) MustRunCommandAndGetStdoutAsFloat64 added in v0.4.0

func (c *CommandExecutorBase) MustRunCommandAndGetStdoutAsFloat64(options *RunCommandOptions) (stdout float64)

func (*CommandExecutorBase) MustRunCommandAndGetStdoutAsLines added in v0.4.2

func (c *CommandExecutorBase) MustRunCommandAndGetStdoutAsLines(options *RunCommandOptions) (stdoutLines []string)

func (*CommandExecutorBase) MustRunCommandAndGetStdoutAsString added in v0.4.0

func (c *CommandExecutorBase) MustRunCommandAndGetStdoutAsString(options *RunCommandOptions) (stdout string)

func (*CommandExecutorBase) MustSetParentCommandExecutorForBaseClass added in v0.4.0

func (c *CommandExecutorBase) MustSetParentCommandExecutorForBaseClass(parentCommandExecutorForBaseClass CommandExecutor)

func (*CommandExecutorBase) RunCommandAndGetStdoutAsBytes added in v0.4.0

func (c *CommandExecutorBase) RunCommandAndGetStdoutAsBytes(options *RunCommandOptions) (stdout []byte, err error)

func (*CommandExecutorBase) RunCommandAndGetStdoutAsFloat64 added in v0.4.0

func (c *CommandExecutorBase) RunCommandAndGetStdoutAsFloat64(options *RunCommandOptions) (stdout float64, err error)

func (*CommandExecutorBase) RunCommandAndGetStdoutAsLines added in v0.4.2

func (c *CommandExecutorBase) RunCommandAndGetStdoutAsLines(options *RunCommandOptions) (stdoutLines []string, err error)

func (*CommandExecutorBase) RunCommandAndGetStdoutAsString added in v0.4.0

func (c *CommandExecutorBase) RunCommandAndGetStdoutAsString(options *RunCommandOptions) (stdout string, err error)

func (*CommandExecutorBase) SetParentCommandExecutorForBaseClass added in v0.4.0

func (c *CommandExecutorBase) SetParentCommandExecutorForBaseClass(parentCommandExecutorForBaseClass CommandExecutor) (err error)

type CommandOutput added in v0.4.0

type CommandOutput struct {
	// contains filtered or unexported fields
}

func NewCommandOutput added in v0.4.0

func NewCommandOutput() (c *CommandOutput)

func (*CommandOutput) GetCmdRunError added in v0.4.0

func (c *CommandOutput) GetCmdRunError() (cmdRunError *error, err error)

func (*CommandOutput) GetCmdRunErrorStringOrEmptyStringIfUnset added in v0.4.0

func (o *CommandOutput) GetCmdRunErrorStringOrEmptyStringIfUnset() (cmdRunErrorString string)

func (*CommandOutput) GetReturnCode added in v0.4.0

func (o *CommandOutput) GetReturnCode() (returnCode int, err error)

func (*CommandOutput) GetStderr added in v0.4.0

func (c *CommandOutput) GetStderr() (stderr *[]byte, err error)

func (*CommandOutput) GetStderrAsString added in v0.4.0

func (o *CommandOutput) GetStderrAsString() (stderr string, err error)

func (*CommandOutput) GetStderrAsStringOrEmptyIfUnset added in v0.4.0

func (o *CommandOutput) GetStderrAsStringOrEmptyIfUnset() (stderr string)

func (*CommandOutput) GetStdout added in v0.4.0

func (c *CommandOutput) GetStdout() (stdout *[]byte, err error)

func (*CommandOutput) GetStdoutAsBytes added in v0.4.0

func (o *CommandOutput) GetStdoutAsBytes() (stdout []byte, err error)

func (*CommandOutput) GetStdoutAsFloat64 added in v0.4.0

func (c *CommandOutput) GetStdoutAsFloat64() (stdout float64, err error)

func (*CommandOutput) GetStdoutAsLines added in v0.4.0

func (o *CommandOutput) GetStdoutAsLines() (stdoutLines []string, err error)

func (*CommandOutput) GetStdoutAsString added in v0.4.0

func (o *CommandOutput) GetStdoutAsString() (stdout string, err error)

func (*CommandOutput) IsExitSuccess added in v0.4.0

func (o *CommandOutput) IsExitSuccess() (isSuccess bool)

func (*CommandOutput) IsTimedOut added in v0.4.0

func (o *CommandOutput) IsTimedOut() (IsTimedOut bool, err error)

func (*CommandOutput) LogStdoutAsInfo added in v0.4.0

func (c *CommandOutput) LogStdoutAsInfo() (err error)

func (*CommandOutput) MustGetCmdRunError added in v0.4.0

func (c *CommandOutput) MustGetCmdRunError() (cmdRunError *error)

func (*CommandOutput) MustGetReturnCode added in v0.4.0

func (c *CommandOutput) MustGetReturnCode() (returnCode int)

func (*CommandOutput) MustGetStderr added in v0.4.0

func (c *CommandOutput) MustGetStderr() (stderr *[]byte)

func (*CommandOutput) MustGetStderrAsString added in v0.4.0

func (c *CommandOutput) MustGetStderrAsString() (stdout string)

func (*CommandOutput) MustGetStdout added in v0.4.0

func (c *CommandOutput) MustGetStdout() (stdout *[]byte)

func (*CommandOutput) MustGetStdoutAsBytes added in v0.4.0

func (c *CommandOutput) MustGetStdoutAsBytes() (stdout []byte)

func (*CommandOutput) MustGetStdoutAsFloat64 added in v0.4.0

func (c *CommandOutput) MustGetStdoutAsFloat64() (stdout float64)

func (*CommandOutput) MustGetStdoutAsLines added in v0.4.0

func (c *CommandOutput) MustGetStdoutAsLines() (stdoutLines []string)

func (*CommandOutput) MustGetStdoutAsString added in v0.4.0

func (c *CommandOutput) MustGetStdoutAsString() (stdout string)

func (*CommandOutput) MustIsTimedOut added in v0.4.0

func (c *CommandOutput) MustIsTimedOut() (IsTimedOut bool)

func (*CommandOutput) MustLogStdoutAsInfo added in v0.4.0

func (c *CommandOutput) MustLogStdoutAsInfo()

func (*CommandOutput) MustSetReturnCode added in v0.4.0

func (c *CommandOutput) MustSetReturnCode(returnCode int)

func (*CommandOutput) MustSetStderr added in v0.4.0

func (c *CommandOutput) MustSetStderr(stderr []byte)

func (*CommandOutput) MustSetStdout added in v0.4.0

func (c *CommandOutput) MustSetStdout(stdout []byte)

func (*CommandOutput) SetCmdRunError added in v0.4.0

func (o *CommandOutput) SetCmdRunError(err error)

func (*CommandOutput) SetReturnCode added in v0.4.0

func (o *CommandOutput) SetReturnCode(returnCode int) (err error)

func (*CommandOutput) SetStderr added in v0.4.0

func (o *CommandOutput) SetStderr(stderr []byte) (err error)

func (*CommandOutput) SetStdout added in v0.4.0

func (o *CommandOutput) SetStdout(stdout []byte) (err error)

type DirectoriesService added in v0.6.0

type DirectoriesService struct {
}

func Directories added in v0.6.0

func Directories() (d *DirectoriesService)

func NewDirectoriesService added in v0.6.0

func NewDirectoriesService() (d *DirectoriesService)

func (*DirectoriesService) CreateLocalDirectoryByPath added in v0.6.0

func (d *DirectoriesService) CreateLocalDirectoryByPath(path string, verbose bool) (l *LocalDirectory, err error)

func (*DirectoriesService) MustCreateLocalDirectoryByPath added in v0.6.0

func (d *DirectoriesService) MustCreateLocalDirectoryByPath(path string, verbose bool) (l *LocalDirectory)

type Directory

type Directory interface {
	Create(verbose bool) (err error)
	Delete(verbose bool) (err error)
	Exists() (exists bool, err error)
	GetLocalPath() (localPath string, err error)
	MustCreate(verbose bool)
	MustDelete(verbose bool)
	MustExists() (exists bool)
	MustGetLocalPath() (localPath string)
}

type DurationFormatterService added in v0.2.0

type DurationFormatterService struct {
}

func DurationFormatter added in v0.2.0

func DurationFormatter() (d *DurationFormatterService)

func NewDurationFormatterService added in v0.2.0

func NewDurationFormatterService() (d *DurationFormatterService)

func (*DurationFormatterService) MustToString added in v0.2.0

func (d *DurationFormatterService) MustToString(duration *time.Duration) (durationString string)

func (*DurationFormatterService) ToString added in v0.2.0

func (d *DurationFormatterService) ToString(duration *time.Duration) (durationString string, err error)

type DurationParserService added in v0.4.0

type DurationParserService struct{}

func DurationParser added in v0.4.0

func DurationParser() (durationParser *DurationParserService)

func NewDurationParserService added in v0.4.0

func NewDurationParserService() (d *DurationParserService)

func (*DurationParserService) MustToSecondsAsString added in v0.4.0

func (d *DurationParserService) MustToSecondsAsString(durationString string) (secondsString string)

func (*DurationParserService) MustToSecondsAsTimeDuration added in v0.4.0

func (d *DurationParserService) MustToSecondsAsTimeDuration(durationString string) (duration *time.Duration)

func (*DurationParserService) MustToSecondsFloat64 added in v0.4.0

func (d *DurationParserService) MustToSecondsFloat64(durationString string) (seconds float64)

func (*DurationParserService) MustToSecondsInt64 added in v0.4.0

func (d *DurationParserService) MustToSecondsInt64(durationString string) (seconds int64)

func (*DurationParserService) ToSecondsAsString added in v0.4.0

func (d *DurationParserService) ToSecondsAsString(durationString string) (secondsString string, err error)

func (*DurationParserService) ToSecondsAsTimeDuration added in v0.4.0

func (d *DurationParserService) ToSecondsAsTimeDuration(durationString string) (duration *time.Duration, err error)

func (*DurationParserService) ToSecondsFloat64 added in v0.4.0

func (d *DurationParserService) ToSecondsFloat64(durationString string) (seconds float64, err error)

func (*DurationParserService) ToSecondsInt64 added in v0.4.0

func (d *DurationParserService) ToSecondsInt64(durationString string) (seconds int64, err error)

type ErrorsService

type ErrorsService struct{}

func Errors

func Errors() (e *ErrorsService)

func NewErrorsService

func NewErrorsService() (e *ErrorsService)

func (ErrorsService) IsEmptyStringError

func (e ErrorsService) IsEmptyStringError(err error) (isEmptyStringError bool)

func (ErrorsService) IsNilError

func (e ErrorsService) IsNilError(err error) (IsNilError bool)

func (ErrorsService) IsNotImplementedError

func (e ErrorsService) IsNotImplementedError(err error) (isNotImplementedError bool)

func (ErrorsService) IsTracedError

func (e ErrorsService) IsTracedError(err error) (isTracedError bool)

Returns true if given error 'err' is a TracedError, false otherwise.

type ExecService added in v0.4.0

type ExecService struct {
	CommandExecutorBase
}

func Exec added in v0.4.0

func Exec() (e *ExecService)

func NewExec added in v0.4.0

func NewExec() (e *ExecService)

func NewExecService added in v0.4.0

func NewExecService() (e *ExecService)

func (*ExecService) MustRunCommand added in v0.4.0

func (e *ExecService) MustRunCommand(options *RunCommandOptions) (commandOutput *CommandOutput)

func (*ExecService) RunCommand added in v0.4.0

func (e *ExecService) RunCommand(options *RunCommandOptions) (commandOutput *CommandOutput, err error)

type ExitCodesService added in v0.4.0

type ExitCodesService struct {
}

func ExitCodes added in v0.4.0

func ExitCodes() (exitCodes *ExitCodesService)

func NewExitCodesService added in v0.4.0

func NewExitCodesService() (e *ExitCodesService)

func (*ExitCodesService) ExitCodeOK added in v0.4.0

func (e *ExitCodesService) ExitCodeOK() (exitCode int)

func (*ExitCodesService) ExitCodeTimeout added in v0.4.0

func (e *ExitCodesService) ExitCodeTimeout() (exitCode int)

type File

type File interface {
	Delete(verbose bool) (err error)
	Exists() (exists bool, err error)
	GetLocalPath() (localPath string, err error)
	GetUriAsString() (uri string, err error)
	MustDelete(verbose bool)
	MustExists() (exists bool)
	MustGetLocalPath() (localPath string)
	MustGetUriAsString() (uri string)
	MustReadAsBytes() (content []byte)
	MustWriteBytes(toWrite []byte, verbose bool)
	ReadAsBytes() (content []byte, err error)
	WriteBytes(toWrite []byte, verbose bool) (err error)

	// All methods below this line can be implemented by embedding the `FileBase` struct:
	MustReadAsString() (content string)
	MustWriteString(content string, verbose bool)
	ReadAsString() (content string, err error)
	WriteString(content string, verbose bool) (err error)
}

A File represents any kind of file regardless if a local file or a remote file.

func GetFileByOsFile added in v0.1.3

func GetFileByOsFile(osFile *os.File) (file File, err error)

func MustGetFileByOsFile added in v0.1.3

func MustGetFileByOsFile(osFile *os.File) (file File)

type FileBase added in v0.1.3

type FileBase struct {
	// contains filtered or unexported fields
}

This is the base for `File` providing most convenience functions for file operations.

func NewFileBase added in v0.1.3

func NewFileBase() (f *FileBase)

func (*FileBase) GetParentFileForBaseClass added in v0.1.3

func (f *FileBase) GetParentFileForBaseClass() (parentFileForBaseClass File, err error)

func (*FileBase) MustGetParentFileForBaseClass added in v0.1.3

func (f *FileBase) MustGetParentFileForBaseClass() (parentFileForBaseClass File)

func (*FileBase) MustReadAsString added in v0.1.3

func (f *FileBase) MustReadAsString() (content string)

func (*FileBase) MustSetParentFileForBaseClass added in v0.1.3

func (f *FileBase) MustSetParentFileForBaseClass(parentFileForBaseClass File)

func (*FileBase) MustWriteString added in v0.1.3

func (f *FileBase) MustWriteString(toWrite string, verbose bool)

func (*FileBase) ReadAsString added in v0.1.3

func (f *FileBase) ReadAsString() (content string, err error)

func (*FileBase) SetParentFileForBaseClass added in v0.1.3

func (f *FileBase) SetParentFileForBaseClass(parentFileForBaseClass File) (err error)

func (*FileBase) WriteString added in v0.1.3

func (f *FileBase) WriteString(toWrite string, verbose bool) (err error)

type LocalDirectory added in v0.6.0

type LocalDirectory struct {
	// contains filtered or unexported fields
}

func GetLocalDirectoryByPath added in v0.6.0

func GetLocalDirectoryByPath(path string) (directory *LocalDirectory, err error)

func MustGetLocalDirectoryByPath added in v0.6.0

func MustGetLocalDirectoryByPath(path string) (directory *LocalDirectory)

func NewLocalDirectory added in v0.6.0

func NewLocalDirectory() (l *LocalDirectory)

func (*LocalDirectory) Create added in v0.6.0

func (l *LocalDirectory) Create(verbose bool) (err error)

func (*LocalDirectory) Delete added in v0.6.0

func (l *LocalDirectory) Delete(verbose bool) (err error)

func (*LocalDirectory) Exists added in v0.6.0

func (l *LocalDirectory) Exists() (exists bool, err error)

func (*LocalDirectory) GetLocalPath added in v0.6.0

func (l *LocalDirectory) GetLocalPath() (localPath string, err error)

func (*LocalDirectory) MustCreate added in v0.6.0

func (l *LocalDirectory) MustCreate(verbose bool)

func (*LocalDirectory) MustDelete added in v0.6.0

func (l *LocalDirectory) MustDelete(verbose bool)

func (*LocalDirectory) MustExists added in v0.6.0

func (l *LocalDirectory) MustExists() (exists bool)

func (*LocalDirectory) MustGetLocalPath added in v0.6.0

func (l *LocalDirectory) MustGetLocalPath() (localPath string)

func (*LocalDirectory) MustSetLocalPath added in v0.6.0

func (l *LocalDirectory) MustSetLocalPath(localPath string)

func (*LocalDirectory) SetLocalPath added in v0.6.0

func (l *LocalDirectory) SetLocalPath(localPath string) (err error)

type LocalFile

type LocalFile struct {
	FileBase
	// contains filtered or unexported fields
}

A LocalFile represents a locally available file.

func GetLocalFileByPath added in v0.5.5

func GetLocalFileByPath(localPath string) (l *LocalFile, err error)

func MustGetLocalFileByPath added in v0.5.5

func MustGetLocalFileByPath(localPath string) (l *LocalFile)

func MustNewLocalFileByPath

func MustNewLocalFileByPath(localPath string) (l *LocalFile)

func NewLocalFile

func NewLocalFile() (l *LocalFile)

func NewLocalFileByPath

func NewLocalFileByPath(localPath string) (l *LocalFile, err error)

func (*LocalFile) Delete added in v0.1.3

func (l *LocalFile) Delete(verbose bool) (err error)

Delete a file if it exists. If the file is already absent this function does nothing.

func (*LocalFile) Exists

func (l *LocalFile) Exists() (exists bool, err error)

func (*LocalFile) GetLocalPath

func (l *LocalFile) GetLocalPath() (path string, err error)

func (*LocalFile) GetPath

func (l *LocalFile) GetPath() (path string, err error)

func (*LocalFile) GetUriAsString

func (l *LocalFile) GetUriAsString() (uri string, err error)

func (*LocalFile) IsPathSet

func (l *LocalFile) IsPathSet() (isSet bool)

func (*LocalFile) MustDelete added in v0.1.3

func (l *LocalFile) MustDelete(verbose bool)

func (*LocalFile) MustExists

func (l *LocalFile) MustExists() (exists bool)

func (*LocalFile) MustGetLocalPath

func (l *LocalFile) MustGetLocalPath() (path string)

func (*LocalFile) MustGetPath

func (l *LocalFile) MustGetPath() (path string)

func (*LocalFile) MustGetUriAsString

func (l *LocalFile) MustGetUriAsString() (uri string)

func (*LocalFile) MustReadAsBytes added in v0.1.3

func (l *LocalFile) MustReadAsBytes() (content []byte)

func (*LocalFile) MustSetPath

func (l *LocalFile) MustSetPath(path string)

func (*LocalFile) MustWriteBytes added in v0.1.3

func (l *LocalFile) MustWriteBytes(toWrite []byte, verbose bool)

func (*LocalFile) ReadAsBytes added in v0.1.3

func (l *LocalFile) ReadAsBytes() (content []byte, err error)

func (*LocalFile) SetPath

func (l *LocalFile) SetPath(path string) (err error)

func (*LocalFile) WriteBytes added in v0.1.3

func (l *LocalFile) WriteBytes(toWrite []byte, verbose bool) (err error)

type LogSettings added in v0.7.1

type LogSettings struct {
	ColorDisabled bool
}

func NewLogSettings added in v0.7.1

func NewLogSettings() (l *LogSettings)

func (*LogSettings) GetColorDisabled added in v0.7.1

func (l *LogSettings) GetColorDisabled() (colorDisabled bool)

func (*LogSettings) IsColorDisabled added in v0.7.1

func (l *LogSettings) IsColorDisabled() (colorDisabled bool)

func (*LogSettings) IsColorEnabled added in v0.7.1

func (l *LogSettings) IsColorEnabled() (colorEnabled bool)

func (*LogSettings) SetColorDisabled added in v0.7.1

func (l *LogSettings) SetColorDisabled(colorDisabled bool)

func (*LogSettings) SetColorEnabled added in v0.7.1

func (l *LogSettings) SetColorEnabled(colorEnabled bool)

type MathService added in v0.3.0

type MathService struct{}

func Math added in v0.3.0

func Math() (m *MathService)

func NewMathService added in v0.3.0

func NewMathService() (m *MathService)

func (*MathService) MaxInt added in v0.3.0

func (m *MathService) MaxInt(integers ...int) (maxValue int)

type OsService added in v0.5.0

type OsService struct{}

func NewOsService added in v0.5.0

func NewOsService() (o *OsService)

func OS added in v0.5.0

func OS() (o *OsService)

func (*OsService) IsRunningOnWindows added in v0.5.0

func (o *OsService) IsRunningOnWindows() (isRunningOnWindows bool)

type PathsService

type PathsService struct{}

func NewPathsService

func NewPathsService() (p *PathsService)

func Paths

func Paths() (p *PathsService)

func (*PathsService) IsAbsolutePath

func (p *PathsService) IsAbsolutePath(path string) (isRelative bool)

Returns true if path is an absolute path. An empty string as path will always be false.

func (*PathsService) IsRelativePath

func (p *PathsService) IsRelativePath(path string) (isRelative bool)

Returns true if path is a relative path. An empty string as path will always be false.

type PointersService

type PointersService struct{}

func NewPointersService

func NewPointersService() (p *PointersService)

func Pointers

func Pointers() (pointers *PointersService)

func (*PointersService) IsPointer

func (p *PointersService) IsPointer(objectToTest interface{}) (isPointer bool)

type PowerShellService added in v0.7.0

type PowerShellService struct {
	CommandExecutorBase
}

func NewPowerShell added in v0.7.0

func NewPowerShell() (p *PowerShellService)

func NewPowerShellService added in v0.7.0

func NewPowerShellService() (p *PowerShellService)

func PowerShell added in v0.7.0

func PowerShell() (p *PowerShellService)

func (*PowerShellService) MustRunCommand added in v0.7.0

func (p *PowerShellService) MustRunCommand(options *RunCommandOptions) (commandOutput *CommandOutput)

func (*PowerShellService) RunCommand added in v0.7.0

func (b *PowerShellService) RunCommand(options *RunCommandOptions) (commandOutput *CommandOutput, err error)

type RunCommandOptions added in v0.4.0

type RunCommandOptions struct {
	Command            []string
	TimeoutString      string
	Verbose            bool
	AllowAllExitCodes  bool
	LiveOutputOnStdout bool

	// Run as "root" user (or Administrator on Windows):
	RunAsRoot bool
}

func NewRunCommandOptions added in v0.4.0

func NewRunCommandOptions() (runCommandOptions *RunCommandOptions)

func (*RunCommandOptions) GetAllowAllExitCodes added in v0.4.0

func (r *RunCommandOptions) GetAllowAllExitCodes() (allowAllExitCodes bool, err error)

func (*RunCommandOptions) GetCommand added in v0.4.0

func (o *RunCommandOptions) GetCommand() (command []string, err error)

func (*RunCommandOptions) GetDeepCopy added in v0.4.0

func (o *RunCommandOptions) GetDeepCopy() (deepCopy *RunCommandOptions)

func (*RunCommandOptions) GetJoinedCommand added in v0.4.0

func (o *RunCommandOptions) GetJoinedCommand() (joinedCommand string, err error)

func (*RunCommandOptions) GetLiveOutputOnStdout added in v0.4.0

func (r *RunCommandOptions) GetLiveOutputOnStdout() (liveOutputOnStdout bool, err error)

func (*RunCommandOptions) GetRunAsRoot added in v0.7.0

func (r *RunCommandOptions) GetRunAsRoot() (runAsRoot bool)

func (*RunCommandOptions) GetTimeoutSecondsAsString added in v0.4.0

func (o *RunCommandOptions) GetTimeoutSecondsAsString() (timeoutSeconds string, err error)

func (*RunCommandOptions) GetTimeoutString added in v0.4.0

func (r *RunCommandOptions) GetTimeoutString() (timeoutString string, err error)

func (*RunCommandOptions) GetVerbose added in v0.4.0

func (r *RunCommandOptions) GetVerbose() (verbose bool, err error)

func (*RunCommandOptions) IsTimeoutSet added in v0.4.0

func (o *RunCommandOptions) IsTimeoutSet() (isSet bool)

func (*RunCommandOptions) MustGetAllowAllExitCodes added in v0.4.0

func (r *RunCommandOptions) MustGetAllowAllExitCodes() (allowAllExitCodes bool)

func (*RunCommandOptions) MustGetCommand added in v0.4.0

func (r *RunCommandOptions) MustGetCommand() (command []string)

func (*RunCommandOptions) MustGetJoinedCommand added in v0.4.0

func (r *RunCommandOptions) MustGetJoinedCommand() (joinedCommand string)

func (*RunCommandOptions) MustGetLiveOutputOnStdout added in v0.4.0

func (r *RunCommandOptions) MustGetLiveOutputOnStdout() (liveOutputOnStdout bool)

func (*RunCommandOptions) MustGetTimeoutSecondsAsString added in v0.4.0

func (r *RunCommandOptions) MustGetTimeoutSecondsAsString() (timeoutSeconds string)

func (*RunCommandOptions) MustGetTimeoutString added in v0.4.0

func (r *RunCommandOptions) MustGetTimeoutString() (timeoutString string)

func (*RunCommandOptions) MustGetVerbose added in v0.4.0

func (r *RunCommandOptions) MustGetVerbose() (verbose bool)

func (*RunCommandOptions) MustSetAllowAllExitCodes added in v0.4.0

func (r *RunCommandOptions) MustSetAllowAllExitCodes(allowAllExitCodes bool)

func (*RunCommandOptions) MustSetCommand added in v0.4.0

func (r *RunCommandOptions) MustSetCommand(command []string)

func (*RunCommandOptions) MustSetLiveOutputOnStdout added in v0.4.0

func (r *RunCommandOptions) MustSetLiveOutputOnStdout(liveOutputOnStdout bool)

func (*RunCommandOptions) MustSetTimeoutString added in v0.4.0

func (r *RunCommandOptions) MustSetTimeoutString(timeoutString string)

func (*RunCommandOptions) MustSetVerbose added in v0.4.0

func (r *RunCommandOptions) MustSetVerbose(verbose bool)

func (*RunCommandOptions) SetAllowAllExitCodes added in v0.4.0

func (r *RunCommandOptions) SetAllowAllExitCodes(allowAllExitCodes bool) (err error)

func (*RunCommandOptions) SetCommand added in v0.4.0

func (r *RunCommandOptions) SetCommand(command []string) (err error)

func (*RunCommandOptions) SetLiveOutputOnStdout added in v0.4.0

func (r *RunCommandOptions) SetLiveOutputOnStdout(liveOutputOnStdout bool) (err error)

func (*RunCommandOptions) SetRunAsRoot added in v0.7.0

func (r *RunCommandOptions) SetRunAsRoot(runAsRoot bool)

func (*RunCommandOptions) SetTimeoutString added in v0.4.0

func (r *RunCommandOptions) SetTimeoutString(timeoutString string) (err error)

func (*RunCommandOptions) SetVerbose added in v0.4.0

func (r *RunCommandOptions) SetVerbose(verbose bool) (err error)

type ShellLineHandlerService added in v0.4.0

type ShellLineHandlerService struct {
}

func NewShellLineHandlerService added in v0.4.0

func NewShellLineHandlerService() (s *ShellLineHandlerService)

func ShellLineHandler added in v0.4.0

func ShellLineHandler() (shellLineHandler *ShellLineHandlerService)

func (*ShellLineHandlerService) Join added in v0.4.0

func (s *ShellLineHandlerService) Join(command []string) (joinedCommand string, err error)

func (*ShellLineHandlerService) MustJoin added in v0.4.0

func (s *ShellLineHandlerService) MustJoin(command []string) (joinedCommand string)

func (*ShellLineHandlerService) MustSplit added in v0.4.0

func (s *ShellLineHandlerService) MustSplit(command string) (splittedCommand []string)

func (*ShellLineHandlerService) Split added in v0.4.0

func (s *ShellLineHandlerService) Split(command string) (splittedCommand []string, err error)

type SlicesService added in v0.3.0

type SlicesService struct {
}

func NewSlicesService added in v0.3.0

func NewSlicesService() (s *SlicesService)

func Slices added in v0.3.0

func Slices() (slices *SlicesService)

func (*SlicesService) AddPrefixToEachString added in v0.3.0

func (s *SlicesService) AddPrefixToEachString(stringSlices []string, prefix string) (output []string)

func (*SlicesService) AddSuffixToEachString added in v0.3.0

func (s *SlicesService) AddSuffixToEachString(stringSlices []string, suffix string) (output []string)

func (*SlicesService) ContainsInt added in v0.3.0

func (s *SlicesService) ContainsInt(intSlice []int, intToSearch int) (containsInt bool)

func (*SlicesService) ContainsString added in v0.3.0

func (s *SlicesService) ContainsString(sliceOfStrings []string, toCheck string) (contains bool)

func (*SlicesService) GetDeepCopyOfStringsSlice added in v0.3.0

func (s *SlicesService) GetDeepCopyOfStringsSlice(sliceOfStrings []string) (deepCopy []string)

func (*SlicesService) GetIntSliceInitialized added in v0.3.0

func (s *SlicesService) GetIntSliceInitialized(nValues int, initValue int) (initializedSlice []int)

func (*SlicesService) GetIntSliceInitializedWithZeros added in v0.3.0

func (s *SlicesService) GetIntSliceInitializedWithZeros(nValues int) (initializedSlice []int)

func (*SlicesService) GetStringElementsNotInOtherSlice added in v0.3.0

func (s *SlicesService) GetStringElementsNotInOtherSlice(toCheck []string, other []string) (elementsNotInOther []string)

func (*SlicesService) MaxIntValuePerIndex added in v0.3.0

func (s *SlicesService) MaxIntValuePerIndex(intSlice1 []int, intSlice2 []int) (maxValues []int)

func (*SlicesService) MustRemoveStringsWhichContains added in v0.3.0

func (s *SlicesService) MustRemoveStringsWhichContains(sliceToRemoveStringsWhichContains []string, searchString string) (cleanedUpSlice []string)

func (*SlicesService) RemoveEmptyStrings added in v0.3.0

func (s *SlicesService) RemoveEmptyStrings(sliceOfStrings []string) (sliceOfStringsWithoutEmptyStrings []string)

func (*SlicesService) RemoveLastElementIfEmptyString added in v0.4.0

func (o *SlicesService) RemoveLastElementIfEmptyString(sliceOfStrings []string) (cleanedUp []string)

func (*SlicesService) RemoveMatchingStrings added in v0.3.0

func (s *SlicesService) RemoveMatchingStrings(sliceToRemoveMatching []string, matchingStringToRemove string) (cleanedUpSlice []string)

func (*SlicesService) RemoveStringEntryAtIndex added in v0.3.0

func (s *SlicesService) RemoveStringEntryAtIndex(elements []string, indexToRemove int) (elementsWithIndexRemoved []string)

func (*SlicesService) RemoveStringsWhichContains added in v0.3.0

func (s *SlicesService) RemoveStringsWhichContains(sliceToRemoveStringsWhichContains []string, searchString string) (cleanedUpSlice []string, err error)

func (*SlicesService) SortStringSlice added in v0.3.0

func (s *SlicesService) SortStringSlice(sliceOfStrings []string) (sorted []string)

func (*SlicesService) SortStringSliceAndRemoveEmpty added in v0.3.0

func (s *SlicesService) SortStringSliceAndRemoveEmpty(input []string) (sortedAndWithoutEmptyStrings []string)

func (*SlicesService) SortVersionStringSlice added in v0.3.0

func (s *SlicesService) SortVersionStringSlice(input []string) (sorted []string)

func (*SlicesService) SplitStrings added in v0.3.0

func (s *SlicesService) SplitStrings(input []string, splitAt string) (splitted []string)

func (*SlicesService) SplitStringsAndRemoveEmpty added in v0.3.0

func (s *SlicesService) SplitStringsAndRemoveEmpty(input []string, splitAt string) (splitted []string)

func (*SlicesService) ToLower added in v0.3.0

func (s *SlicesService) ToLower(input []string) (lower []string)

func (*SlicesService) TrimAllPrefix added in v0.3.0

func (o *SlicesService) TrimAllPrefix(sliceOfStrings []string, prefixToRemove string) (sliceOfStringsWithPrefixRemoved []string)

func (*SlicesService) TrimPrefix added in v0.3.0

func (s *SlicesService) TrimPrefix(sliceOfStrings []string, prefixToRemove string) (sliceOfStringsWithPrefixRemoved []string)

func (*SlicesService) TrimSpace added in v0.3.0

func (s *SlicesService) TrimSpace(toTrim []string) (trimmed []string)

type StringsService added in v0.3.0

type StringsService struct{}

func NewStringsService added in v0.3.0

func NewStringsService() (s *StringsService)

func Strings added in v0.3.0

func Strings() (stringsService *StringsService)

func (*StringsService) ContainsAtLeastOneSubstring added in v0.3.0

func (s *StringsService) ContainsAtLeastOneSubstring(input string, substrings []string) (atLeastOneSubstringFound bool)

func (*StringsService) ContainsAtLeastOneSubstringIgnoreCase added in v0.3.0

func (s *StringsService) ContainsAtLeastOneSubstringIgnoreCase(input string, substring []string) (atLeastOneSubstringFound bool)

func (*StringsService) ContainsCommentOnly added in v0.3.0

func (s *StringsService) ContainsCommentOnly(input string) (containsCommentOnly bool)

func (*StringsService) CountLines added in v0.3.0

func (s *StringsService) CountLines(input string) (nLines int)

func (*StringsService) EnsureEndsWithExactlyOneLineBreak added in v0.3.0

func (s *StringsService) EnsureEndsWithExactlyOneLineBreak(input string) (ensuredLineBreak string)

func (*StringsService) EnsureEndsWithLineBreak added in v0.3.0

func (s *StringsService) EnsureEndsWithLineBreak(input string) (ensuredLineBreak string)

func (*StringsService) EnsureFirstCharLowercase added in v0.3.0

func (s *StringsService) EnsureFirstCharLowercase(input string) (firstCharUppercase string)

func (*StringsService) EnsureFirstCharUppercase added in v0.3.0

func (s *StringsService) EnsureFirstCharUppercase(input string) (firstCharUppercase string)

func (*StringsService) EnsureSuffix added in v0.3.0

func (s *StringsService) EnsureSuffix(input string, suffix string) (ensuredSuffix string)

func (*StringsService) FirstCharToUpper added in v0.3.0

func (s *StringsService) FirstCharToUpper(input string) (output string)

func (*StringsService) GetFirstLine added in v0.3.0

func (s *StringsService) GetFirstLine(input string) (firstLine string)

func (*StringsService) GetFirstLineAndTrimSpace added in v0.3.0

func (s *StringsService) GetFirstLineAndTrimSpace(input string) (firstLine string)

func (*StringsService) GetFirstLineWithoutCommentAndTrimSpace added in v0.3.0

func (s *StringsService) GetFirstLineWithoutCommentAndTrimSpace(input string) (firstLine string)

func (*StringsService) GetNumberOfLinesWithPrefix added in v0.3.0

func (s *StringsService) GetNumberOfLinesWithPrefix(content string, prefix string, trimLines bool) (numberOfLinesWithPrefix int)

func (*StringsService) HasAtLeastOnePrefix added in v0.3.0

func (s *StringsService) HasAtLeastOnePrefix(toCheck string, prefixes []string) (hasPrefix bool)

func (*StringsService) HasPrefixIgnoreCase added in v0.3.0

func (s *StringsService) HasPrefixIgnoreCase(input string, prefix string) (hasPrefix bool)

func (*StringsService) IsComment added in v0.3.0

func (s *StringsService) IsComment(input string) (isComment bool)

func (*StringsService) IsFirstCharLowerCase added in v0.3.0

func (s *StringsService) IsFirstCharLowerCase(input string) (isFirstCharLowerCase bool)

func (*StringsService) IsFirstCharUpperCase added in v0.3.0

func (s *StringsService) IsFirstCharUpperCase(input string) (isFirstCharUpperCase bool)

func (*StringsService) RemoveCommentMarkers added in v0.3.0

func (s *StringsService) RemoveCommentMarkers(input string) (commentContent string)

func (*StringsService) RemoveCommentMarkersAndTrimSpace added in v0.3.0

func (s *StringsService) RemoveCommentMarkersAndTrimSpace(input string) (commentContent string)

func (*StringsService) RemoveComments added in v0.3.0

func (s *StringsService) RemoveComments(input string) (contentWithoutComments string)

func (*StringsService) RemoveCommentsAndTrimSpace added in v0.3.0

func (s *StringsService) RemoveCommentsAndTrimSpace(input string) (output string)

func (*StringsService) RemoveSurroundingQuotationMarks added in v0.3.0

func (s *StringsService) RemoveSurroundingQuotationMarks(input string) (output string)

func (*StringsService) RemoveTailingNewline added in v0.3.0

func (s *StringsService) RemoveTailingNewline(input string) (cleaned string)

func (*StringsService) RepeatReplaceAll added in v0.3.0

func (s *StringsService) RepeatReplaceAll(input string, search string, replaceWith string) (replaced string)

func (*StringsService) RightFillWithSpaces added in v0.3.0

func (s *StringsService) RightFillWithSpaces(input string, fillLength int) (filled string)

func (*StringsService) SplitAtSpacesAndRemoveEmptyStrings added in v0.3.0

func (s *StringsService) SplitAtSpacesAndRemoveEmptyStrings(input string) (splitted []string)

func (*StringsService) SplitFirstLineAndContent added in v0.3.0

func (s *StringsService) SplitFirstLineAndContent(input string) (firstLine string, contentWithoutFirstLine string)

func (*StringsService) SplitLines added in v0.3.0

func (s *StringsService) SplitLines(input string) (splittedLines []string)

func (*StringsService) SplitWords added in v0.3.0

func (s *StringsService) SplitWords(input string) (words []string)

func (*StringsService) ToPascalCase added in v0.3.0

func (s *StringsService) ToPascalCase(input string) (pascalCase string)

func (*StringsService) ToSnakeCase added in v0.3.0

func (s *StringsService) ToSnakeCase(input string) (snakeCase string)

func (*StringsService) TrimAllPrefix added in v0.3.0

func (s *StringsService) TrimAllPrefix(stringToCheck string, prefixToRemove string) (trimmedString string)

func (*StringsService) TrimAllSuffix added in v0.3.0

func (s *StringsService) TrimAllSuffix(stringToCheck string, suffixToRemove string) (trimmedString string)

func (*StringsService) TrimPrefixIgnoreCase added in v0.3.0

func (s *StringsService) TrimPrefixIgnoreCase(input string, prefix string) (trimmed string)

func (*StringsService) TrimSpaceForEveryLine added in v0.3.0

func (s *StringsService) TrimSpaceForEveryLine(input string) (trimmedForEveryLine string)

func (*StringsService) TrimSpacesLeft added in v0.3.0

func (s *StringsService) TrimSpacesLeft(input string) (trimmedLeft string)

func (*StringsService) TrimSuffixAndSpace added in v0.3.0

func (s *StringsService) TrimSuffixAndSpace(input string, suffix string) (output string)

func (*StringsService) TrimSuffixUntilAbsent added in v0.3.0

func (s *StringsService) TrimSuffixUntilAbsent(input string, suffixToRemove string) (withoutSuffix string)

type StructsService

type StructsService struct{}

func NewStructsService

func NewStructsService() (s *StructsService)

func Structs

func Structs() (structs *StructsService)

func (*StructsService) GetFieldValuesAsString

func (s *StructsService) GetFieldValuesAsString(structToGetFieldsFrom interface{}) (values []string, err error)

func (*StructsService) IsPointerToStruct

func (s *StructsService) IsPointerToStruct(objectToTest interface{}) (isStruct bool)

func (*StructsService) IsStruct

func (s *StructsService) IsStruct(objectToTest interface{}) (isStruct bool)

func (*StructsService) IsStructOrPointerToStruct

func (s *StructsService) IsStructOrPointerToStruct(objectToTest interface{}) (isStruct bool)

func (*StructsService) MustGetFieldValuesAsString

func (s *StructsService) MustGetFieldValuesAsString(structToGetFieldsFrom interface{}) (values []string)

type TemporaryDirectoriesService added in v0.6.0

type TemporaryDirectoriesService struct {
}

func NewTemporaryDirectoriesService added in v0.6.0

func NewTemporaryDirectoriesService() (t *TemporaryDirectoriesService)

func TemporaryDirectories added in v0.6.0

func TemporaryDirectories() (TemporaryDirectorys *TemporaryDirectoriesService)

func (*TemporaryDirectoriesService) CreateEmptyTemporaryDirectory added in v0.6.0

func (t *TemporaryDirectoriesService) CreateEmptyTemporaryDirectory(verbose bool) (TemporaryDirectory Directory, err error)

func (*TemporaryDirectoriesService) CreateEmptyTemporaryDirectoryAndGetPath added in v0.6.0

func (t *TemporaryDirectoriesService) CreateEmptyTemporaryDirectoryAndGetPath(verbose bool) (TemporaryDirectoryPath string, err error)

func (*TemporaryDirectoriesService) MustCreateEmptyTemporaryDirectory added in v0.6.0

func (t *TemporaryDirectoriesService) MustCreateEmptyTemporaryDirectory(verbose bool) (TemporaryDirectory Directory)

func (*TemporaryDirectoriesService) MustCreateEmptyTemporaryDirectoryAndGetPath added in v0.6.0

func (t *TemporaryDirectoriesService) MustCreateEmptyTemporaryDirectoryAndGetPath(verbose bool) (TemporaryDirectoryPath string)

type TemporaryFilesService added in v0.1.3

type TemporaryFilesService struct {
}

func NewTemporaryFilesService added in v0.1.3

func NewTemporaryFilesService() (t *TemporaryFilesService)

func TemporaryFiles added in v0.1.3

func TemporaryFiles() (temporaryFiles *TemporaryFilesService)

func (*TemporaryFilesService) CreateEmptyTemporaryFile added in v0.1.3

func (t *TemporaryFilesService) CreateEmptyTemporaryFile(verbose bool) (temporaryfile File, err error)

func (*TemporaryFilesService) CreateEmptyTemporaryFileAndGetPath added in v0.1.3

func (t *TemporaryFilesService) CreateEmptyTemporaryFileAndGetPath(verbose bool) (temporaryFilePath string, err error)

func (*TemporaryFilesService) CreateFromString added in v0.1.3

func (t *TemporaryFilesService) CreateFromString(content string, verbose bool) (temporaryFile File, err error)

func (*TemporaryFilesService) MustCreateEmptyTemporaryFile added in v0.1.3

func (t *TemporaryFilesService) MustCreateEmptyTemporaryFile(verbose bool) (temporaryfile File)

func (*TemporaryFilesService) MustCreateEmptyTemporaryFileAndGetPath added in v0.1.3

func (t *TemporaryFilesService) MustCreateEmptyTemporaryFileAndGetPath(verbose bool) (temporaryFilePath string)

func (*TemporaryFilesService) MustCreateFromString added in v0.1.3

func (t *TemporaryFilesService) MustCreateFromString(content string, verbose bool) (temporaryFile File)

type TerminalColorsService

type TerminalColorsService struct{}

func NewTerminalColorsService

func NewTerminalColorsService() (t *TerminalColorsService)

func TerminalColors

func TerminalColors() (terminalColors *TerminalColorsService)

func (*TerminalColorsService) GetCodeBlack

func (t *TerminalColorsService) GetCodeBlack() (code string)

func (*TerminalColorsService) GetCodeBlue

func (t *TerminalColorsService) GetCodeBlue() (code string)

func (*TerminalColorsService) GetCodeBrightBlack

func (t *TerminalColorsService) GetCodeBrightBlack() (code string)

func (*TerminalColorsService) GetCodeBrightBlue

func (t *TerminalColorsService) GetCodeBrightBlue() (code string)

func (*TerminalColorsService) GetCodeBrightCyan

func (t *TerminalColorsService) GetCodeBrightCyan() (code string)

func (*TerminalColorsService) GetCodeBrightGreen

func (t *TerminalColorsService) GetCodeBrightGreen() (code string)

func (*TerminalColorsService) GetCodeBrightMagenta

func (t *TerminalColorsService) GetCodeBrightMagenta() (code string)

func (*TerminalColorsService) GetCodeBrightRed

func (t *TerminalColorsService) GetCodeBrightRed() (code string)

func (*TerminalColorsService) GetCodeBrightWhite

func (t *TerminalColorsService) GetCodeBrightWhite() (code string)

func (*TerminalColorsService) GetCodeBrightYellow

func (t *TerminalColorsService) GetCodeBrightYellow() (code string)

func (*TerminalColorsService) GetCodeCyan

func (t *TerminalColorsService) GetCodeCyan() (code string)

func (*TerminalColorsService) GetCodeGray

func (t *TerminalColorsService) GetCodeGray() (code string)

func (*TerminalColorsService) GetCodeGreen

func (t *TerminalColorsService) GetCodeGreen() (code string)

func (*TerminalColorsService) GetCodeMangenta

func (t *TerminalColorsService) GetCodeMangenta() (code string)

func (*TerminalColorsService) GetCodeNoColor

func (t *TerminalColorsService) GetCodeNoColor() (code string)

func (*TerminalColorsService) GetCodeRed

func (t *TerminalColorsService) GetCodeRed() (code string)

func (*TerminalColorsService) GetCodeWhite

func (t *TerminalColorsService) GetCodeWhite() (code string)

func (*TerminalColorsService) GetCodeYellow

func (t *TerminalColorsService) GetCodeYellow() (code string)

type TestsService

type TestsService struct{}

func NewTestsService

func NewTestsService() (t *TestsService)

func Tests

func Tests() (tests *TestsService)

func (*TestsService) FormatAsTestname

func (t *TestsService) FormatAsTestname(objectToFormat interface{}) (testname string, err error)

func (*TestsService) MustFormatAsTestname

func (t *TestsService) MustFormatAsTestname(objectToFormat interface{}) (testname string)

type TicToc added in v0.2.0

type TicToc struct {
	// contains filtered or unexported fields
}

func MustTic added in v0.2.0

func MustTic(title string, verbose bool) (t *TicToc)

func NewTicToc added in v0.2.0

func NewTicToc() (t *TicToc)

func Tic added in v0.2.0

func Tic(title string, verbose bool) (t *TicToc, err error)

func TicWithoutTitle added in v0.2.0

func TicWithoutTitle(verbose bool) (t *TicToc)

func (*TicToc) GetTStart added in v0.2.0

func (t *TicToc) GetTStart() (tStart *time.Time, err error)

func (*TicToc) GetTitle added in v0.2.0

func (t *TicToc) GetTitle() (title string, err error)

func (*TicToc) GetTitleOrDefaultIfUnset added in v0.2.0

func (t *TicToc) GetTitleOrDefaultIfUnset() (title string)

func (*TicToc) MustGetTStart added in v0.2.0

func (t *TicToc) MustGetTStart() (tStart *time.Time)

func (*TicToc) MustGetTitle added in v0.2.0

func (t *TicToc) MustGetTitle() (title string)

func (*TicToc) MustSetTStart added in v0.2.0

func (t *TicToc) MustSetTStart(tStart *time.Time)

func (*TicToc) MustSetTitle added in v0.2.0

func (t *TicToc) MustSetTitle(title string)

func (*TicToc) MustToc added in v0.2.0

func (t *TicToc) MustToc(verbose bool) (elapsedTime *time.Duration)

func (*TicToc) SetTStart added in v0.2.0

func (t *TicToc) SetTStart(tStart *time.Time) (err error)

func (*TicToc) SetTitle added in v0.2.0

func (t *TicToc) SetTitle(title string) (err error)

func (*TicToc) Start added in v0.2.0

func (t *TicToc) Start(verbose bool)

func (*TicToc) Toc added in v0.2.0

func (t *TicToc) Toc(verbose bool) (elapsedTime *time.Duration, err error)

type TracedErrorType

type TracedErrorType struct {
	// contains filtered or unexported fields
}

func NewTracedErrorType

func NewTracedErrorType() (t *TracedErrorType)

func (TracedErrorType) Error

func (t TracedErrorType) Error() (errorMessage string)

func (*TracedErrorType) GetErrorsToUnwrap

func (t *TracedErrorType) GetErrorsToUnwrap() (errorsToUnwrap []error, err error)

func (*TracedErrorType) GetFormattedError

func (t *TracedErrorType) GetFormattedError() (formattedError error, err error)

func (*TracedErrorType) GetFunctionCalls

func (t *TracedErrorType) GetFunctionCalls() (functionCalls []string, err error)

func (*TracedErrorType) MustGetErrorsToUnwrap

func (t *TracedErrorType) MustGetErrorsToUnwrap() (errorsToUnwrap []error)

func (*TracedErrorType) MustGetFormattedError

func (t *TracedErrorType) MustGetFormattedError() (formattedError error)

func (*TracedErrorType) MustGetFunctionCalls

func (t *TracedErrorType) MustGetFunctionCalls() (functionCalls []string)

func (*TracedErrorType) MustSetErrorsToUnwrap

func (t *TracedErrorType) MustSetErrorsToUnwrap(errorsToUnwrap []error)

func (*TracedErrorType) MustSetFormattedError

func (t *TracedErrorType) MustSetFormattedError(formattedError error)

func (*TracedErrorType) MustSetFunctionCalls

func (t *TracedErrorType) MustSetFunctionCalls(functionCalls []string)

func (*TracedErrorType) SetErrorsToUnwrap

func (t *TracedErrorType) SetErrorsToUnwrap(errorsToUnwrap []error) (err error)

func (*TracedErrorType) SetFormattedError

func (t *TracedErrorType) SetFormattedError(formattedError error) (err error)

func (*TracedErrorType) SetFunctionCalls

func (t *TracedErrorType) SetFunctionCalls(functionCalls []string) (err error)

func (TracedErrorType) Unwrap

func (t TracedErrorType) Unwrap() (errors []error)

type UTF16Service added in v0.5.0

type UTF16Service struct{}

func NewUTF16Service added in v0.5.0

func NewUTF16Service() (u *UTF16Service)

func UTF16 added in v0.5.0

func UTF16() (u *UTF16Service)

func (*UTF16Service) DecodeAsBytes added in v0.5.0

func (u *UTF16Service) DecodeAsBytes(utf16 []byte) (decoded []byte, err error)

func (*UTF16Service) DecodeAsString added in v0.5.0

func (u *UTF16Service) DecodeAsString(utf16 []byte) (decoded string, err error)

func (*UTF16Service) MustDecodeAsBytes added in v0.5.0

func (u *UTF16Service) MustDecodeAsBytes(utf16 []byte) (decoded []byte)

func (*UTF16Service) MustDecodeAsString added in v0.5.0

func (u *UTF16Service) MustDecodeAsString(utf16 []byte) (decoded string)

type WindowsService added in v0.5.0

type WindowsService struct{}

func NewWindowsService added in v0.5.0

func NewWindowsService() (w *WindowsService)

func Windows added in v0.5.0

func Windows() (w *WindowsService)

Provides Windows (the operating system) related functions.

func (*WindowsService) DecodeAsBytes added in v0.5.0

func (w *WindowsService) DecodeAsBytes(windowsUtf16 []byte) (decoded []byte, err error)

func (*WindowsService) DecodeAsString added in v0.5.0

func (w *WindowsService) DecodeAsString(windowsUtf16 []byte) (decoded string, err error)

func (*WindowsService) DecodeStringAsString added in v0.5.0

func (w *WindowsService) DecodeStringAsString(windowsUtf16 string) (decoded string, err error)

func (*WindowsService) IsRunningOnWindows added in v0.5.0

func (w *WindowsService) IsRunningOnWindows() (isRunningOnWindows bool)

func (*WindowsService) MustDecodeAsBytes added in v0.5.0

func (w *WindowsService) MustDecodeAsBytes(windowsUtf16 []byte) (decoded []byte)

func (*WindowsService) MustDecodeAsString added in v0.5.0

func (w *WindowsService) MustDecodeAsString(windowsUtf16 []byte) (decoded string)

func (*WindowsService) MustDecodeStringAsString added in v0.5.0

func (w *WindowsService) MustDecodeStringAsString(windowsUtf16 string) (decoded string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL