util

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CommentWidth = 80

Variables

This section is empty.

Functions

func ColorBlack

func ColorBlack(text string) string

func ColorBlue

func ColorBlue(text string) string

func ColorCyan

func ColorCyan(text string) string

func ColorGreen

func ColorGreen(text string) string

func ColorPurple

func ColorPurple(text string) string

func ColorRed

func ColorRed(text string) string

func ColorRedBold

func ColorRedBold(text string) string

func ColorWhite

func ColorWhite(text string) string

func ColorYellow

func ColorYellow(text string) string

func DisableColor added in v0.2.0

func DisableColor()

func NewSlogHandler

func NewSlogHandler(writer *os.File, level string) slog.Handler

func PrintDiff

func PrintDiff(leftName string, leftData []byte, rightName string, rightData []byte)

func PrintDiffWithFunction

func PrintDiffWithFunction(leftName string, leftData []byte, rightName string, rightData []byte, output func(string))

func PrintFile

func PrintFile(name string, data []byte)

func PrintFileWithFunction

func PrintFileWithFunction(name string, data []byte, output func(string))

func PrintGeneratedFile

func PrintGeneratedFile(name string, data []byte)

func SetTabSize

func SetTabSize(size int)

func WrapComment

func WrapComment(s string) []string

func WrapText

func WrapText(s string, width int) []string

Types

type SlogHandler

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

func (*SlogHandler) Enabled

func (h *SlogHandler) Enabled(_ context.Context, level slog.Level) bool

func (*SlogHandler) Handle

func (h *SlogHandler) Handle(_ context.Context, r slog.Record) error

func (*SlogHandler) SetLevel

func (h *SlogHandler) SetLevel(level string)

func (*SlogHandler) WithAttrs

func (h *SlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*SlogHandler) WithGroup

func (h *SlogHandler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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