utils

package
v2.0.0-...-c01ee7d Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorColor    = "\x1b[31m"
	SuccessColor  = "\x1b[32m"
	DefaultColor  = "\x1b[0m"
	TriangleColor = "\x1b[33m"
)

Variables

This section is empty.

Functions

func DownloadImage

func DownloadImage(url string) (*os.File, error)

DownloadImage downloads the image from the internet and saves it into a temporary file.

func FormatTime

func FormatTime(d time.Duration) string

FormatTime formats time.Duration output to a human readable value.

func IsValidUrl

func IsValidUrl(uri string) bool

IsValidUrl tests a string to determine if it is a well-structured url or not.

Types

type Spinner

type Spinner struct {
	StopMsg string
	// contains filtered or unexported fields
}

Spinner initializes the progress indicator.

func NewSpinner

func NewSpinner(msg string, d time.Duration, hideCursor bool) *Spinner

NewSpinner instantiates a new progress indicator.

func (*Spinner) RestoreCursor

func (s *Spinner) RestoreCursor()

RestoreCursor restores back the cursor visibility.

func (*Spinner) Start

func (s *Spinner) Start()

Start starts the progress indicator.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the progress indicator.

Jump to

Keyboard shortcuts

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