utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandExists

func CommandExists(cmd string) bool

CommandExists checks if a command is available in PATH

func ExpandHome

func ExpandHome(path string) (string, error)

ExpandHome expands ~ to the user's home directory

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes converts bytes to human-readable format (e.g., "1.2 GB")

func FormatCount

func FormatCount(count int) string

FormatCount formats numbers with commas (e.g., "1,234")

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration in human-readable format

func FormatPercentage

func FormatPercentage(value, total int64) string

FormatPercentage formats a percentage with 1 decimal place

func GetDirSize

func GetDirSize(path string) (int64, error)

GetDirSize calculates the total size of a directory recursively

func IsWritable

func IsWritable(path string) bool

IsWritable checks if a path is writable by the current user

func PathExists

func PathExists(path string) bool

PathExists checks if a path exists on the filesystem

func SafeRemove

func SafeRemove(path string, dryRun bool) error

SafeRemove removes a path, respecting the dryRun flag

Types

This section is empty.

Jump to

Keyboard shortcuts

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