Documentation ¶
Index ¶
- Constants
- Variables
- func Format(i int64, units int) string
- func FormatBytes(i int64) (result string)
- type Callback
- type ProgressBar
- func (pb *ProgressBar) Add(add int) int
- func (pb *ProgressBar) Finish()
- func (pb *ProgressBar) FinishPrint(str string)
- func (pb *ProgressBar) Increment() int
- func (pb *ProgressBar) Read(p []byte) (n int, err error)
- func (pb *ProgressBar) Set(current int)
- func (pb *ProgressBar) Start()
- func (pb *ProgressBar) Write(p []byte) (n int, err error)
Constants ¶
View Source
const ( // By default, without type handle U_NO = 0 // Handle as b, Kb, Mb, etc U_BYTES = 1 )
View Source
const ( TIOCGWINSZ = 0x5413 TIOCGWINSZ_OSX = 1074295912 )
Variables ¶
View Source
var ( // Default refresh rate - 200ms DefaultRefreshRate = time.Millisecond * 200 BarStart = "[" BarEnd = "]" Empty = "_" Current = "=" CurrentN = ">" )
Functions ¶
func FormatBytes ¶
Convert bytes to human readable string. Like a 2 MiB, 64.2 KiB, 52 B
Types ¶
type Callback ¶
type Callback func(out string)
Callback for custom output For example:
bar.Callback = func(s string) { mySuperPrint(s) }
type ProgressBar ¶
type ProgressBar struct { Total int64 RefreshRate time.Duration ShowPercent, ShowCounters bool ShowSpeed, ShowTimeLeft, ShowBar bool Output io.Writer Callback Callback NotPrint bool Units int // contains filtered or unexported fields }
func (*ProgressBar) FinishPrint ¶
func (pb *ProgressBar) FinishPrint(str string)
End print and write string 'str'
Click to show internal directories.
Click to hide internal directories.