utils

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeMarkdown

func EscapeMarkdown(s string) string

EscapeMarkdown escapes special markdown characters.

func FormatDuration

func FormatDuration(seconds int32) string

FormatDuration formats seconds into a human-readable duration.

func FormatFileSize

func FormatFileSize(bytes int64) string

FormatFileSize formats bytes into a human-readable size.

func PadRight

func PadRight(s string, width int) string

PadRight pads a string with spaces to reach the target width.

func RelativeTime

func RelativeTime(t time.Time) string

RelativeTime returns a human-friendly relative time string.

func SanitizeForTerminal

func SanitizeForTerminal(s string) string

SanitizeForTerminal removes control characters that could interfere with terminal rendering, preserving newlines and tabs.

func StripANSI

func StripANSI(s string) string

StripANSI removes ANSI escape sequences from a string.

func Truncate

func Truncate(s string, maxWidth int) string

Truncate truncates a string to maxWidth, adding ellipsis if needed.

func TruncateMiddle

func TruncateMiddle(s string, maxWidth int) string

TruncateMiddle truncates a string in the middle, preserving start and end.

Types

This section is empty.

Jump to

Keyboard shortcuts

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