util

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Colors = map[string]color.Color{
	"FgBlack":         color.FgBlack,
	"FgRed":           color.FgRed,
	"FgGreen":         color.FgGreen,
	"FgYellow":        color.FgYellow,
	"FgBlue":          color.FgBlue,
	"FgMagenta":       color.FgMagenta,
	"FgCyan":          color.FgCyan,
	"FgWhite":         color.FgWhite,
	"FgDefault":       color.FgDefault,
	"FgDarkGray":      color.FgDarkGray,
	"FgLightRed":      color.FgLightRed,
	"FgLightGreen":    color.FgLightGreen,
	"FgLightYellow":   color.FgLightYellow,
	"FgLightBlue":     color.FgLightBlue,
	"FgLightMagenta":  color.FgLightMagenta,
	"FgLightCyan":     color.FgLightCyan,
	"FgLightWhite":    color.FgLightWhite,
	"FgGray":          color.FgGray,
	"BgBlack":         color.BgBlack,
	"BgRed":           color.BgRed,
	"BgGreen":         color.BgGreen,
	"BgYellow":        color.BgYellow,
	"BgBlue":          color.BgBlue,
	"BgMagenta":       color.BgMagenta,
	"BgCyan":          color.BgCyan,
	"BgWhite":         color.BgWhite,
	"BgDefault":       color.BgDefault,
	"BgDarkGray":      color.BgDarkGray,
	"BgLightRed":      color.BgLightRed,
	"BgLightGreen":    color.BgLightGreen,
	"BgLightYellow":   color.BgLightYellow,
	"BgLightBlue":     color.BgLightBlue,
	"BgLightMagenta":  color.BgLightMagenta,
	"BgLightCyan":     color.BgLightCyan,
	"BgLightWhite":    color.BgLightWhite,
	"BgGray":          color.BgGray,
	"OpReset":         color.OpReset,
	"OpBold":          color.OpBold,
	"OpFuzzy":         color.OpFuzzy,
	"OpItalic":        color.OpItalic,
	"OpUnderscore":    color.OpUnderscore,
	"OpBlink":         color.OpBlink,
	"OpFastBlink":     color.OpFastBlink,
	"OpReverse":       color.OpReverse,
	"OpConcealed":     color.OpConcealed,
	"OpStrikethrough": color.OpStrikethrough,
	"Red":             color.Red,
	"Cyan":            color.Cyan,
	"Gray":            color.Gray,
	"Blue":            color.Blue,
	"Black":           color.Black,
	"Green":           color.Green,
	"White":           color.White,
	"Yellow":          color.Yellow,
	"Magenta":         color.Magenta,
	"Bold":            color.Bold,
	"Normal":          color.Normal,
	"LightRed":        color.LightRed,
	"LightCyan":       color.LightCyan,
	"LightBlue":       color.LightBlue,
	"LightGreen":      color.LightGreen,
	"LightWhite":      color.LightWhite,
	"LightYellow":     color.LightYellow,
	"LightMagenta":    color.LightMagenta,
}

Colors ...

Functions

func ColorsFromLabel

func ColorsFromLabel(label string) (color.Style, error)

ColorsFromLabel ...

func DirExists added in v1.0.3

func DirExists(path string) bool

DirExists ...

func ExeDirectory

func ExeDirectory() string

ExeDirectory ...

func ExpandPath added in v1.0.3

func ExpandPath(path string) string

ExpandPath ...

func ExtractFromMap

func ExtractFromMap(m map[string]interface{}, key string) interface{}

ExtractFromMap ...

func ExtractStringSliceFromMap added in v1.0.3

func ExtractStringSliceFromMap(m map[string]interface{}, key string) ([]string, error)

ExtractStringSliceFromMap ...

func FileExists

func FileExists(path string) bool

FileExists ...

func FileStat

func FileStat(path string, ensureExists bool) os.FileInfo

FileStat ...

func MkdirAll added in v0.9.5

func MkdirAll(path string)

MkdirAll ...

func MustStringSlice added in v1.0.3

func MustStringSlice(raw interface{}) ([]string, error)

MustStringSlice ...

func ReadFile

func ReadFile(path string) []byte

ReadFile ...

func RemoveDir added in v1.0.3

func RemoveDir(path string)

RemoveDir ...

func RemoveFile

func RemoveFile(path string)

RemoveFile ...

func ReplaceFile added in v1.0.3

func ReplaceFile(path string, content []byte)

ReplaceFile ...

func ToBool

func ToBool(v interface{}) bool

ToBool ...

func UnmashalYAMLAgain

func UnmashalYAMLAgain(in interface{}, out interface{}) error

UnmashalYAMLAgain ...

func WriteFileIfNotFound added in v1.0.3

func WriteFileIfNotFound(path string, content []byte)

WriteFileIfNotFound ...

Types

type AnyValue added in v0.9.12

type AnyValue = *AnyValueT

AnyValue ...

func AnyValueFromRaw added in v0.9.12

func AnyValueFromRaw(lineNo int, raw interface{}, replace map[string]string) AnyValue

AnyValueFromRaw ...

func (AnyValue) String added in v0.9.12

func (i AnyValue) String() string

Format ...

type AnyValueT added in v0.9.12

type AnyValueT struct {
	Raw  interface{}
	Text string
}

AnyValueT ...

type Color

type Color = *ColorT

Color ...

func (Color) MarshalYAML

func (i Color) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (Color) Reset

func (i Color) Reset()

Reset ...

func (Color) Set

func (i Color) Set(label string)

Set ...

func (Color) Sprint

func (i Color) Sprint(a interface{}) string

Sprint is alias of the 'Render'

func (Color) Sprintf added in v1.0.3

func (i Color) Sprintf(format string, a ...interface{}) string

Sprintf is alias of the 'Render'

func (Color) String

func (i Color) String() string

func (Color) UnmarshalYAML

func (i Color) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type ColorT

type ColorT struct {
	yaml.Unmarshaler
	yaml.Marshaler
	// contains filtered or unexported fields
}

ColorT ...

type LogFile

type LogFile = *LogFileT

LogFile ...

func InitLogger

func InitLogger(jogHomeDir string) LogFile

InitLogger ...

func (LogFile) Close

func (i LogFile) Close()

Close ...

func (LogFile) Open

func (i LogFile) Open()

Open ...

func (LogFile) Write

func (i LogFile) Write(p []byte) (int, error)

Write ...

type LogFileT

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

LogFileT implements io.Writer

type MultiString added in v0.9.17

type MultiString = *MultiStringT

MultiString ...

func (MultiString) Contains added in v0.9.17

func (i MultiString) Contains(v string, caseSensitive bool) bool

Contains ...

func (MultiString) MarshalYAML added in v0.9.17

func (i MultiString) MarshalYAML() (interface{}, error)

MarshalYAML ...

func (MultiString) Reset added in v0.9.17

func (i MultiString) Reset()

Reset ...

func (MultiString) Set added in v0.9.17

func (i MultiString) Set(valuesText string)

Set ...

func (MultiString) String added in v0.9.17

func (i MultiString) String() string

func (MultiString) UnmarshalYAML added in v0.9.17

func (i MultiString) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ...

type MultiStringT added in v0.9.17

type MultiStringT struct {
	yaml.Unmarshaler
	yaml.Marshaler

	Text             string
	Values           map[string]bool
	LowercasedValues map[string]bool
}

MultiStringT ...

type Printable added in v0.9.12

type Printable interface {
	IsEnabled() bool
	GetColor(value string) Color
	PrintTo(color Color, builder *strings.Builder, a string)
}

Printable ...

type TailQueue added in v0.9.12

type TailQueue = *TailQueueT

TailQueue ...

func NewTailQueue added in v0.9.13

func NewTailQueue(size int) TailQueue

NewTailQueue ...

func (TailQueue) Add added in v0.9.12

func (i TailQueue) Add(element interface{})

Add ...

func (TailQueue) Clear added in v0.9.12

func (i TailQueue) Clear()

Clear ...

func (TailQueue) Count added in v0.9.12

func (i TailQueue) Count() int

Count ...

func (TailQueue) Head added in v0.9.13

func (i TailQueue) Head() interface{}

Head ...

func (TailQueue) IsEmpty added in v0.9.12

func (i TailQueue) IsEmpty() bool

IsEmpty ...

func (TailQueue) IsFull added in v0.9.12

func (i TailQueue) IsFull() bool

IsFull ...

func (TailQueue) Kick added in v0.9.12

func (i TailQueue) Kick() interface{}

Kick ...

func (TailQueue) Tail added in v0.9.13

func (i TailQueue) Tail() interface{}

Tail ...

type TailQueueT added in v0.9.12

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

TailQueueT ...

Jump to

Keyboard shortcuts

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