utils

package
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertStrings

func AssertStrings(as []any) ([]string, error)

AssertStrings converts a slice of any into a slice of strings.

func BytesAreEmptyIsh

func BytesAreEmptyIsh(b []byte) bool

BytesAreEmptyIsh checks if the provided byte slice is practically empty. Can handle cases where a nil pointer or empty struct were marshalled to YAML.

func CountDir

func CountDir(dir string) (int, int64, error)

CountDir returns the number of files in a directory and the total size.

func FilterNil

func FilterNil[T any](list []*T) []*T

FilterNil filters nil entries from a list.

func FmtSemver

func FmtSemver(s string) string

FmtSemver forces a string formatted as a semver version with "v" prefix.

func PrettyBytes

func PrettyBytes(size int64) string

PrettyBytes returns the number of bytes formatted for human readability.

func TerminalWidth

func TerminalWidth(fallback int) int

TerminalWidth returns the width of the terminal, using fallback if it can't determine width.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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