text

package
v12.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CyanCode = "\x1b[36m"

	ResetCode = "\x1b[0m"
)

Variables

View Source
var UseColor = true

UseColor determines if package will emit colors.

Functions

func Blue

func Blue(in string) string

func Bold

func Bold(in string) string

func ColorHash

func ColorHash(name string) (output string)

ColorHash Colors text using a hashing algorithm. The same text will always produce the same color while different text will produce a different color.

func Cyan

func Cyan(in string) string

func FormatTime

func FormatTime(i int) string

Formats a unix timestamp to ISO 8601 date (yyyy-mm-dd).

func FormatTimeQuery

func FormatTimeQuery(i int) string

Formats a unix timestamp to ISO 8601 date (Mon 02 Jan 2006 03:04:05 PM MST).

func Green

func Green(in string) string

func Human

func Human(size int64) string

Human method returns results in human readable format.

func LessRunes

func LessRunes(iRunes, jRunes []rune) bool

LessRunes compares two rune values, and returns true if the first argument is lexicographicaly smaller.

func Magenta

func Magenta(in string) string

func Red

func Red(in string) string

func SplitDBFromName

func SplitDBFromName(pkg string) (db, name string)

SplitDBFromName split apart db/package to db and package.

Types

type ErrInputOverflow

type ErrInputOverflow struct{}

func (ErrInputOverflow) Error

func (e ErrInputOverflow) Error() string

type Logger

type Logger struct {
	Debug bool
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(stdout, stderr io.Writer, r io.Reader, debug bool, name string) *Logger

func (*Logger) Child

func (l *Logger) Child(name string) *Logger

func (*Logger) ContinueTask added in v12.1.3

func (l *Logger) ContinueTask(s string, preset, noConfirm bool) bool

ContinueTask prompts if user wants to continue task. If NoConfirm is set the action will continue without user input.

func (*Logger) Debugln

func (l *Logger) Debugln(a ...any)

func (*Logger) Error

func (l *Logger) Error(a ...any)

func (*Logger) Errorln

func (l *Logger) Errorln(a ...any)

func (*Logger) GetInput

func (l *Logger) GetInput(defaultValue string, noConfirm bool) (string, error)

func (*Logger) Info

func (l *Logger) Info(a ...any)

func (*Logger) Infoln

func (l *Logger) Infoln(a ...any)

func (*Logger) OperationInfo

func (l *Logger) OperationInfo(a ...any)

func (*Logger) OperationInfoln

func (l *Logger) OperationInfoln(a ...any)

func (*Logger) Print

func (l *Logger) Print(a ...any)

func (*Logger) Printf

func (l *Logger) Printf(format string, a ...any)

func (*Logger) Println

func (l *Logger) Println(a ...any)

func (*Logger) SprintError

func (l *Logger) SprintError(a ...any) string

func (*Logger) SprintOperationInfo

func (l *Logger) SprintOperationInfo(a ...any) string

func (*Logger) SprintWarn

func (l *Logger) SprintWarn(a ...any) string

func (*Logger) Warn

func (l *Logger) Warn(a ...any)

func (*Logger) Warnln

func (l *Logger) Warnln(a ...any)

Jump to

Keyboard shortcuts

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