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(headline string, num int64, valColor color.Color) *TasksProgressBar
- func (bm *ProgressBarMng) NewDoneTasksProgressBar() *TasksProgressBar
- func (bm *ProgressBarMng) NewDoubleValueProgressBar(firstValueHeadLine string, secondValueHeadLine string, totalTasks1 int64, ...) *TasksProgressBar
- func (bm *ProgressBarMng) NewHeadLineDoubleValProgBar(headLine string, counterLine string, counterLine2 string, totalTasks1 int64, ...) *TasksWithHeadlineProg
- func (bm *ProgressBarMng) NewHeadlineBar(msg string) *mpb.Bar
- func (bm *ProgressBarMng) NewHeadlineBarWithSpinner(msg string) *mpb.Bar
- func (bm *ProgressBarMng) NewStringProgressBar(headline string, updateFn func() string) *TasksProgressBar
- func (bm *ProgressBarMng) NewTasksProgressBar(totalTasks int64, windows bool, taskType string) *TasksProgressBar
- func (bm *ProgressBarMng) NewTasksWithHeadlineProg(totalTasks int64, headline string, spinner bool, color Color, windows bool, ...) *TasksWithHeadlineProg
- func (bm *ProgressBarMng) NewUpdatableHeadlineBarWithSpinner(updateFn func() string) *mpb.Bar
- 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(headline string, num int64, valColor color.Color) *TasksProgressBar
func (*ProgressBarMng) NewDoneTasksProgressBar ¶
func (bm *ProgressBarMng) NewDoneTasksProgressBar() *TasksProgressBar
func (*ProgressBarMng) NewDoubleValueProgressBar ¶ added in v2.24.3
func (bm *ProgressBarMng) NewDoubleValueProgressBar(firstValueHeadLine string, secondValueHeadLine string, totalTasks1 int64, OptionalTotalTasks1, optionalDoneTasks1, totalTasks2, doneTaks2 *int64, windows bool, colour Color) *TasksProgressBar
A progress bar with two counters values shown on the right side of the progress bar; The first value controls what the bar shows. The total tasks1 can be passes as an int or *int, if you want to use it with int send nil to the optional total and done tasks1 and the wanted totalTasks to total tasks1.
func (*ProgressBarMng) NewHeadLineDoubleValProgBar ¶ added in v2.24.3
func (bm *ProgressBarMng) NewHeadLineDoubleValProgBar(headLine string, counterLine string, counterLine2 string, totalTasks1 int64, optionalTotal1, optionalDone1, totalTasks2, DoneTasks2 *int64, windows bool, color Color) *TasksWithHeadlineProg
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) NewStringProgressBar ¶ added in v2.21.0
func (bm *ProgressBarMng) NewStringProgressBar(headline string, updateFn func() string) *TasksProgressBar
func (*ProgressBarMng) NewTasksProgressBar ¶
func (bm *ProgressBarMng) NewTasksProgressBar(totalTasks int64, windows bool, taskType string) *TasksProgressBar
func (*ProgressBarMng) NewTasksWithHeadlineProg ¶
func (bm *ProgressBarMng) NewTasksWithHeadlineProg(totalTasks int64, headline string, spinner bool, color Color, windows bool, taskType string) *TasksWithHeadlineProg
func (*ProgressBarMng) NewUpdatableHeadlineBarWithSpinner ¶ added in v2.25.0
func (bm *ProgressBarMng) NewUpdatableHeadlineBarWithSpinner(updateFn func() string) *mpb.Bar
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