utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Verbose bool

Verbose enabled or disabled showing debug messages in CLI.

Functions

func FormatDuration

func FormatDuration(d interface{}) string

FormatDuration renders human friendly duration string.

func Log

func Log(name string, args ...string)

Log adds debug message to the output.

func Printf

func Printf(format string, args ...interface{})

Printf works identically to fmt.Print but adds `<white+hb>color formatting support for CLI</reset>`.

func RandString

func RandString(n int) string

RandString returns random string (lowercased) of desired length.

func Sprintf

func Sprintf(format string, args ...interface{}) string

Sprintf works identically to fmt.Sprintf but adds `<white+hb>color formatting support for CLI</reset>`.

Types

type Banner struct {
	// contains filtered or unexported fields
}

Banner allows automatic line alignment within desired width, banner includes color rendering.

func NewBanner

func NewBanner(width int) *Banner

NewBanner returns new banner of desired width.

func (*Banner) Add

func (b *Banner) Add(format string, args ...interface{})

Add adds new line to banner

func (*Banner) String

func (b *Banner) String() string

Render returns compiled banner string.

type Progress

type Progress struct {
	// contains filtered or unexported fields
}

Progress allows to represent processing state using progress bar or spinner.

func NewProgress

func NewProgress(total time.Duration, pbType string) *Progress

NewProgress returns progress bar or spinner based on given total duration.

func (*Progress) Finish

func (p *Progress) Finish()

Finish finishes the progress bar or spinner.

func (*Progress) Set

func (p *Progress) Set(t time.Duration)

Set updates progress position based on current progress duration.

Jump to

Keyboard shortcuts

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