utils

package
v0.0.0-...-c5a7534 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Good     = green
	Warn     = yellow
	Err      = red
	NoColors = false
)

Functions

func Color

func Color(colorString string) func(...interface{}) string

func FormatBytes

func FormatBytes(sizeBytes float64) string

FormatBytes format bytes to TiB, GiB, MiB, KiB depending on the size

func PrettyPrint

func PrettyPrint(i interface{}) string

PrettyPrint a struct, used for debugging

func Wrap

func Wrap(s string, start string, end string) string

Wrap `s` around start and end, returns <start>s<end>

Types

type Pad

type Pad struct {
	Delims  map[string]int
	Content string
}

Pad holds the pad char and its number of spaces a map as well as the string itself

func (*Pad) Do

func (p *Pad) Do() string

Do performs the padding

type StringSet

type StringSet map[string]struct{}

StringSet a set for strings, useful for keeping track of elements

func (StringSet) Contains

func (s StringSet) Contains(v string) bool

Contains returns true if `v` is in the set

func (StringSet) FromList

func (s StringSet) FromList(listIn []string) StringSet

FromList returns a `StringSet` with the input list's contents

Jump to

Keyboard shortcuts

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