Documentation ¶
Index ¶
- Constants
- Variables
- type Color
- type ProgressBarMng
- func (bm *ProgressBarMng) DoneTask(prog *TasksWithHeadlineProg)
- func (bm *ProgressBarMng) GetBarsWg() *sync.WaitGroup
- func (bm *ProgressBarMng) GetLogFile() *os.File
- func (bm *ProgressBarMng) IncBy(n int, prog *TasksWithHeadlineProg)
- func (bm *ProgressBarMng) Increment(prog *TasksWithHeadlineProg)
- func (bm *ProgressBarMng) NewCounterProgressBar(num int64, headline string) *TasksProgressBar
- func (bm *ProgressBarMng) NewDoneTasksProgressBar() *TasksProgressBar
- func (bm *ProgressBarMng) NewHeadlineBar(msg string) *mpb.Bar
- func (bm *ProgressBarMng) NewHeadlineBarWithSpinner(msg string) *mpb.Bar
- func (bm *ProgressBarMng) NewTasksProgressBar(totalTasks int64, color Color, taskType string) *TasksProgressBar
- func (bm *ProgressBarMng) NewTasksWithHeadlineProg(totalTasks int64, headline string, spinner bool, color Color, taskType string) *TasksWithHeadlineProg
- func (bm *ProgressBarMng) QuitTasksWithHeadlineProg(prog *TasksWithHeadlineProg)
- type TasksProgressBar
- type TasksWithHeadlineProg
Constants ¶
const ( ProgressBarWidth = 20 ProgressRefreshRate = 200 * time.Millisecond )
Variables ¶
var ShouldInitProgressBar = func() (bool, error) { ci, err := utils.GetBoolEnvValue(coreutils.CI, false) if ci || err != nil { return false, err } if !log.IsStdErrTerminal() { return false, err } err = setTerminalWidthVar() if err != nil { return false, err } return true, nil }
The ShouldInitProgressBar func is used to determine whether the progress bar should be displayed. This default implementation will init the progress bar if the following conditions are met: CI == false (or unset) and Stderr is a terminal.
Functions ¶
This section is empty.
Types ¶
type ProgressBarMng ¶
type ProgressBarMng struct {
// contains filtered or unexported fields
}
func NewBarsMng ¶
func NewBarsMng() (mng *ProgressBarMng, shouldInit bool, err error)
func (*ProgressBarMng) DoneTask ¶
func (bm *ProgressBarMng) DoneTask(prog *TasksWithHeadlineProg)
DoneTask increase tasks counter to the number of totalTasks.
func (*ProgressBarMng) GetBarsWg ¶ added in v2.20.0
func (bm *ProgressBarMng) GetBarsWg() *sync.WaitGroup
func (*ProgressBarMng) GetLogFile ¶ added in v2.20.0
func (bm *ProgressBarMng) GetLogFile() *os.File
func (*ProgressBarMng) IncBy ¶
func (bm *ProgressBarMng) IncBy(n int, prog *TasksWithHeadlineProg)
Increment increments completed tasks count by n.
func (*ProgressBarMng) Increment ¶
func (bm *ProgressBarMng) Increment(prog *TasksWithHeadlineProg)
Increment increments completed tasks count by 1.
func (*ProgressBarMng) NewCounterProgressBar ¶ added in v2.19.0
func (bm *ProgressBarMng) NewCounterProgressBar(num int64, headline string) *TasksProgressBar
func (*ProgressBarMng) NewDoneTasksProgressBar ¶
func (bm *ProgressBarMng) NewDoneTasksProgressBar() *TasksProgressBar
func (*ProgressBarMng) NewHeadlineBar ¶
func (bm *ProgressBarMng) NewHeadlineBar(msg string) *mpb.Bar
func (*ProgressBarMng) NewHeadlineBarWithSpinner ¶
func (bm *ProgressBarMng) NewHeadlineBarWithSpinner(msg string) *mpb.Bar
NewHeadlineBar Initializes a new progress bar for headline, with an optional spinner
func (*ProgressBarMng) NewTasksProgressBar ¶
func (bm *ProgressBarMng) NewTasksProgressBar(totalTasks int64, color Color, taskType string) *TasksProgressBar
func (*ProgressBarMng) NewTasksWithHeadlineProg ¶
func (bm *ProgressBarMng) NewTasksWithHeadlineProg(totalTasks int64, headline string, spinner bool, color Color, taskType string) *TasksWithHeadlineProg
func (*ProgressBarMng) QuitTasksWithHeadlineProg ¶ added in v2.20.0
func (bm *ProgressBarMng) QuitTasksWithHeadlineProg(prog *TasksWithHeadlineProg)
type TasksProgressBar ¶ added in v2.20.0
type TasksProgressBar struct {
// contains filtered or unexported fields
}
TasksProgressBar counts tasks that have been completed, using a "%d/%d" format.
func (*TasksProgressBar) GetTasksCount ¶ added in v2.20.0
func (tpb *TasksProgressBar) GetTasksCount() int64
func (*TasksProgressBar) IncGeneralProgressTotalBy ¶ added in v2.20.0
func (p *TasksProgressBar) IncGeneralProgressTotalBy(n int64)
IncGeneralProgressTotalBy increments the amount of total by n.
func (*TasksProgressBar) SetGeneralProgressTotal ¶ added in v2.20.0
func (p *TasksProgressBar) SetGeneralProgressTotal(n int64)
SetGeneralProgressTotal sets the amount of total to n.
type TasksWithHeadlineProg ¶ added in v2.20.0
type TasksWithHeadlineProg struct {
// contains filtered or unexported fields
}
Progress that includes two bars: 1. Headline bar 2. Tasks counter progress bar.
func (*TasksWithHeadlineProg) GetTasksProgressBar ¶ added in v2.20.0
func (hp *TasksWithHeadlineProg) GetTasksProgressBar() *TasksProgressBar