Documentation
¶
Index ¶
- Constants
- func Abs[T constraints.Signed | constraints.Float](x T) T
- func DecorateText(s string, msgType MessageType) string
- func DetectContentType(fname string) (interface{}, error)
- func DownloadImage(url string) (*os.File, error)
- func FormatTime(d time.Duration) string
- func HexToRGBA(x string) color.NRGBA
- func IsValidUrl(uri string) bool
- func Max[T constraints.Ordered](values ...T) T
- func Min[T constraints.Ordered](values ...T) T
- type MessageType
- type Spinner
Constants ¶
const ( DefaultColor = "\x1b[0m" StatusColor = "\x1b[36m" SuccessColor = "\x1b[32m" ErrorColor = "\x1b[31m" )
Colors used accross the CLI application.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[T constraints.Signed | constraints.Float](x T) T
Abs returns the absolut value of x.
func DecorateText ¶
func DecorateText(s string, msgType MessageType) string
DecorateText shows the message types in different colors.
func DetectContentType ¶
DetectContentType detects the file type by reading MIME type information of the file content.
func DownloadImage ¶
DownloadImage downloads the image from the internet and saves it into a temporary file.
func FormatTime ¶
FormatTime formats time.Duration output to a human readable value.
func IsValidUrl ¶
IsValidUrl tests a string to determine if it is a well-structured url or not.
func Max ¶
func Max[T constraints.Ordered](values ...T) T
Max returns the biggest value of the provided parameters.
func Min ¶
func Min[T constraints.Ordered](values ...T) T
Min returns the slowest value of the provided parameters.
Types ¶
type MessageType ¶
type MessageType int
MessageType is a custom type used as a placeholder for various message types.
const ( DefaultMessage MessageType = iota SuccessMessage ErrorMessage StatusMessage )
The message types used accross the CLI application.
type Spinner ¶
type Spinner struct { StopMsg string // contains filtered or unexported fields }
Spinner initializes the progress indicator.
func NewSpinner ¶
NewSpinner instantiates a new progress indicator.
func (*Spinner) RestoreCursor ¶
func (s *Spinner) RestoreCursor()
RestoreCursor restores back the cursor visibility.