-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
34 lines (31 loc) · 898 Bytes
/
types.go
File metadata and controls
34 lines (31 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package progressbar
// config structure for initial settings parameters
type progressBarConfig struct {
spinner []string
edges [2]string
colors [2]string
fillers [2]string
withPercent bool
withSpinner bool
}
// ProgressBar the interface defines methods for working with the progress bar
type ProgressBar interface {
Update(percent int) (string, error)
SetColors(newColors [2]string)
SetPercent(newPercent int) error
SetBarLen(newBarLen int) error
SetEdges(newEdges [2]string)
SetFillers(newFillers [2]string)
SetSpinner(newSpinner []string) error
WithPercent(show bool)
WithSpinner(show bool)
GetCurrentPercent() int
}
// progressBar structure containing all elements and settings of the progress bar
type progressBar struct {
barLen int
percent int
config progressBarConfig
spinnerState int
spinnerLen int
}