utils

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedColor    = "\033[31m"
	YellowColor = "\033[33m"
	BlueColor   = "\033[34m"
	ResetColor  = "\033[0m"
)

ANSI escape codes for color

Variables

View Source
var (
	Spinner *yacspin.Spinner
)

global spinner

Functions

func BoolValue added in v0.2.2

func BoolValue(b *bool) bool

boolValue safely dereferences a bool pointer, returning false if nil

func Confirm added in v0.1.7

func Confirm(msg string) bool

func DownloadUrl added in v0.2.0

func DownloadUrl(url, dest string) error

downloads a file from a url and places it in a specified destination

func ExpandTilde added in v0.2.1

func ExpandTilde(paths []string) []string

Function to expand the tilde (~) to the full home directory path @Example ~/Pictures/flowers.png --> /home/username/Pictures/flowers.png

func ExtractArchiveBinary added in v0.2.2

func ExtractArchiveBinary(src, dest, binary string) error

func FindBinary added in v0.2.2

func FindBinary(binaryNames map[string]string, destFolder string) (string, error)

FindBinary checks that the binary exists in dest or $PATH, preferring $PATH. Checks that binary also has executable permissions.

func FormatErrors added in v0.1.6

func FormatErrors(errs []error) string

Formats a slice of errors to a single error, each seperated by a new line

func GetFileExtensionFromURL added in v0.1.7

func GetFileExtensionFromURL(rawurl string) (string, error)

func HandleError added in v0.1.6

func HandleError(err error, msg ...string)

Prints the error in red and exits

func NewSpinner added in v0.2.2

func NewSpinner(cfg yacspin.Config)

Creates a new global spinner

func OpenURL added in v0.1.7

func OpenURL(url string) error

opens a URL in your default browser of your operating system

func SetSpinnerQuiet added in v0.2.2

func SetSpinnerQuiet(quiet bool)

Sets the spinner to quiet mode by discarding all output to not interfere with Unix pipes or redirections

func SpinnerConfig added in v0.2.2

func SpinnerConfig() yacspin.Config

Types

This section is empty.

Jump to

Keyboard shortcuts

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