utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug     logs.Level = 10
	Warn      logs.Level = 20
	Info      logs.Level = 30
	Error     logs.Level = 40
	Important logs.Level = 50

	DefaultLogStyle = map[logs.Level]string{
		Debug:     termenv.String(tui.Rocket+"[+]").Bold().Background(tui.Blue).String() + " %s ",
		Warn:      termenv.String(tui.Zap+"[warn]").Bold().Background(tui.Yellow).String() + " %s ",
		Important: termenv.String(tui.Fire+"[*]").Bold().Background(tui.Purple).String() + " %s ",
		Info:      termenv.String(tui.HotSpring+"[i]").Bold().Background(tui.Green).String() + " %s ",
		Error:     termenv.String(tui.Monster+"[-]").Bold().Background(tui.Red).String() + " %s ",
	}
)

Functions

func ByteCountBinary

func ByteCountBinary(b int64) string

ByteCountBinary - Pretty print byte size

func ChmodR

func ChmodR(path string, filePerm, dirPerm os.FileMode) error

ChmodR - Recursively chmod

func CopyFile

func CopyFile(src string, dst string) error

CopyFile - Copy a file from src to dst

func DeflateBuf

func DeflateBuf(data []byte) []byte

DeflateBuf - Deflate a buffer using BestCompression (9)

func Keys

func Keys[M ~map[K]V, K comparable, V any](m M) []K

From the x/exp source code - gets a slice of keys for a map

func ReadFileFromTarGz

func ReadFileFromTarGz(tarGzFile string, tarPath string) ([]byte, error)

ReadFileFromTarGz - Read a file from a tar.gz file in-memory

func ResolvePath

func ResolvePath(in string) string

ResolvePath - Resolve a path from an assumed root path

Types

type BOFArgsBuffer

type BOFArgsBuffer struct {
	Buffer *bytes.Buffer
}

func (*BOFArgsBuffer) AddData

func (b *BOFArgsBuffer) AddData(d []byte) error

func (*BOFArgsBuffer) AddInt

func (b *BOFArgsBuffer) AddInt(d uint32) error

func (*BOFArgsBuffer) AddShort

func (b *BOFArgsBuffer) AddShort(d uint16) error

func (*BOFArgsBuffer) AddString

func (b *BOFArgsBuffer) AddString(d string) error

func (*BOFArgsBuffer) AddWString

func (b *BOFArgsBuffer) AddWString(d string) error

func (*BOFArgsBuffer) GetBuffer

func (b *BOFArgsBuffer) GetBuffer() ([]byte, error)

Jump to

Keyboard shortcuts

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