utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 18 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
	GroupStyle                 = lipgloss.NewStyle().Foreground(lipgloss.Color("#8BE9FD"))
	NameStyle                  = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF79C6"))
	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 ",
	}
)
View Source
var (
	ErrFuncHasNotEnoughParams = errors.New("func has not enough params")
)

Functions

func AdaptSessionColor added in v0.0.2

func AdaptSessionColor(prePrompt, sId string) string

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 ExtractTarGz added in v0.0.2

func ExtractTarGz(gzipPath string, dest string) error

ExtractTarGz extracts a .tar.gz file to the specified destination directory

func ForceRemoveAll added in v0.0.2

func ForceRemoveAll(rootPath string)

func GetParam added in v0.0.2

func GetParam[T any](param interface{}) (T, error)

func InstallArtifact added in v0.0.2

func InstallArtifact(aliasGzFilePath string, installPath, artifactPath string) error

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 MustGetParam added in v0.0.2

func MustGetParam[T any](param interface{}) T

func NewSessionColor added in v0.0.2

func NewSessionColor(prePrompt, sId string) string

func PackArgs added in v0.0.2

func PackArgs(data []string) ([]string, error)

func PackBinary added in v0.0.2

func PackBinary(data string) string

func PackInt added in v0.0.2

func PackInt(i uint32) (string, error)

func PackIntString added in v0.0.2

func PackIntString(s string) (string, error)

func PackShort added in v0.0.2

func PackShort(i uint16) (string, error)

func PackShortString added in v0.0.2

func PackShortString(s string) (string, error)

func PackString added in v0.0.2

func PackString(s string) string

func PackWideString added in v0.0.2

func PackWideString(s string) string

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)

type IoMBOFArgsBuffer added in v0.0.2

type IoMBOFArgsBuffer struct {
	Args []string
}

func (*IoMBOFArgsBuffer) AddData added in v0.0.2

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

func (*IoMBOFArgsBuffer) AddInt added in v0.0.2

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

func (*IoMBOFArgsBuffer) AddShort added in v0.0.2

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

func (*IoMBOFArgsBuffer) AddString added in v0.0.2

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

func (*IoMBOFArgsBuffer) AddWString added in v0.0.2

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

func (*IoMBOFArgsBuffer) GetArgs added in v0.0.2

func (b *IoMBOFArgsBuffer) GetArgs() []string

Jump to

Keyboard shortcuts

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