com

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PlainF     = plain.FprintfFunc()
	GreenF     = green.FprintfFunc()
	GreenBoldF = greenBold.FprintfFunc()
	YellowF    = yellow.FprintfFunc()
	CyanF      = cyan.FprintfFunc()
	BoldF      = bold.FprintfFunc()

	PlainS     = plain.SprintfFunc()
	GreenS     = green.SprintfFunc()
	GreenBoldS = greenBold.SprintfFunc()
	YellowS    = yellow.SprintfFunc()
	CyanS      = cyan.SprintfFunc()
	BoldS      = bold.SprintfFunc()
)
View Source
var (
	IsTty          = checkTty()
	TerminalIsUtf8 = checkTerminalUtf8()
)

Functions

func AllNils

func AllNils[T comparable](vals []*T) bool

func CreateFilePathAndWriteJson

func CreateFilePathAndWriteJson(path string, jsonData interface{}) error

func CreateFilePathAndWriteString

func CreateFilePathAndWriteString(path string, str string) error

func DeleteFileIfExists

func DeleteFileIfExists(relativePath string) error

func Dump

func Dump(item any) string

func FileExists

func FileExists(path string) bool

func Int64Max

func Int64Max(a, b int64) int64

func Int64Min

func Int64Min(a, b int64) int64

func IntMax

func IntMax(a, b int) int

func IntMin

func IntMin(a, b int) int

func IsBlank

func IsBlank(str string) bool

func LoadJson

func LoadJson(path string) (interface{}, error)

func Memoize

func Memoize[T any](f func() T) func() T

func NotNil

func NotNil[T comparable](val *T, nilProvider func() T) bool

this is the best way I can think of to do the 'typed nil' check...

func NumIsAre

func NumIsAre(values int) string

func Pluralize

func Pluralize(count int, singular string) string

follows some basic rules of english, use PluralizeCustom to override the plural.

func PluralizeCustom

func PluralizeCustom(count int, singular string, plural string) string

func Reverse

func Reverse(str string) string

func SortedKeys

func SortedKeys[T any](m map[string]T) []string

func StrLen

func StrLen(str string) int

Simple len(str) call counts bytes, not runes, so e.g. emojis gets counted as multiple characters

func ToAbsolutePath

func ToAbsolutePath(path string) string

func Truncate

func Truncate(str string, maxLen int64) string

Types

type LoadFileResult

type LoadFileResult struct {
	Content   string
	SizeBytes int64
	Error     error
}

func LoadFile

func LoadFile(path string) LoadFileResult

type Rgb

type Rgb struct {
	R int
	G int
	B int
}

func NewRgb

func NewRgb(r, g, b int) Rgb

func NewRgb64

func NewRgb64(r, g, b int64) Rgb

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any]() *Stack[T]

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() (T, bool)

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (T, bool)

func (*Stack[T]) Push

func (s *Stack[T]) Push(item T)

Jump to

Keyboard shortcuts

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