v1.4.6 Latest Latest

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

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 16 Imported by: 1




View Source
const (
	DefaultColor = "\x1b[0m"
	StatusColor  = "\x1b[36m"
	SuccessColor = "\x1b[32m"
	ErrorColor   = "\x1b[31m"

Colors used across the CLI application.


This section is empty.


func Abs added in v1.4.3

func Abs[T constraints.Signed | constraints.Float](x T) T

Abs returns the absolut value of x.

func Contains added in v1.4.5

func Contains[T comparable](slice []T, value T) bool

Contains returns true if a value is available in the collection.

func DecorateText

func DecorateText(s string, msgType MessageType) string

DecorateText shows the message types in different colors.

func DetectContentType added in v1.4.1

func DetectContentType(fname string) (interface{}, error)

DetectContentType detects the file type by reading MIME type information of the file content.

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 HSL added in v1.4.5

func HSL(h, s, l float32) color.NRGBA

HSL returns color based on HSL in range 0..1

func HSLA added in v1.4.5

func HSLA(h, s, l, a float32) color.NRGBA

HSLA returns color based on HSLA in range 0..1

func HexToRGBA added in v1.4.1

func HexToRGBA(x string) color.NRGBA

HexToRGBA converts a color expressed as hexadecimal string to RGBA color.

func IsValidUrl

func IsValidUrl(uri string) bool

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

func Max added in v1.4.3

func Max[T constraints.Ordered](values ...T) T

Max returns the biggest value of the provided parameters.

func Min added in v1.4.3

func Min[T constraints.Ordered](values ...T) T

Min returns the slowest value of the provided parameters.

func RGB added in v1.4.5

func RGB(r, g, b float32) color.NRGBA

RGB returns color based on RGB in range 0..1

func RGBA added in v1.4.5

func RGBA(r, g, b, a float32) color.NRGBA

RGBA returns color based on RGBA in range 0..1


type MessageType

type MessageType int

MessageType is a custom type used as a placeholder for various message types.

const (
	DefaultMessage MessageType = iota

The message types used across the CLI application.

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) *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