progressbar

package
v2.39.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProgressBarWidth = 20

	ProgressRefreshRate = 200 * time.Millisecond
)

Variables

View Source
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 Color

type Color int64
const (
	WHITE Color = iota
	GREEN       = 1
)

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) 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) NewTasksWithHeadlineProgressBar added in v2.29.8

func (bm *ProgressBarMng) NewTasksWithHeadlineProgressBar(totalTasks int64, headline string, spinner bool, windows bool, taskType string) *TasksWithHeadlineProg

Initialize a regular tasks progress bar, with a headline above it

func (*ProgressBarMng) NewUpdatableHeadlineBarWithSpinner added in v2.25.0

func (bm *ProgressBarMng) NewUpdatableHeadlineBarWithSpinner(updateFn func() string) *mpb.Bar

func (*ProgressBarMng) QuitTasksWithHeadlineProgressBar added in v2.29.8

func (bm *ProgressBarMng) QuitTasksWithHeadlineProgressBar(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) GetBar added in v2.20.0

func (p *TasksProgressBar) GetBar() *mpb.Bar

func (*TasksProgressBar) GetTasksCount added in v2.20.0

func (tpb *TasksProgressBar) GetTasksCount() int64

func (*TasksProgressBar) GetTotal added in v2.20.0

func (p *TasksProgressBar) GetTotal() 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

type TransferProgressMng

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

func InitTransferProgressBarMng added in v2.31.2

func InitTransferProgressBarMng(state *state.TransferStateManager, allRepos []string) (mng *TransferProgressMng, shouldInit bool, err error)

func (*TransferProgressMng) GetBarMng added in v2.29.8

func (tpm *TransferProgressMng) GetBarMng() *ProgressBarMng

func (*TransferProgressMng) NewErrorBar added in v2.29.8

func (tpm *TransferProgressMng) NewErrorBar() *TasksProgressBar

func (*TransferProgressMng) NewErrorNote added in v2.29.8

func (tpm *TransferProgressMng) NewErrorNote() *TasksProgressBar

func (*TransferProgressMng) NewGeneralProgBar added in v2.29.8

func (tpm *TransferProgressMng) NewGeneralProgBar() *TasksProgressBar

func (*TransferProgressMng) NewPhase1ProgressBar added in v2.29.8

func (tpm *TransferProgressMng) NewPhase1ProgressBar() *TasksWithHeadlineProg

func (*TransferProgressMng) NewPhase2ProgressBar added in v2.29.8

func (tpm *TransferProgressMng) NewPhase2ProgressBar() *TasksWithHeadlineProg

func (*TransferProgressMng) NewPhase3ProgressBar added in v2.29.8

func (tpm *TransferProgressMng) NewPhase3ProgressBar() *TasksWithHeadlineProg

func (*TransferProgressMng) NewRepositoriesProgressBar added in v2.29.8

func (tpm *TransferProgressMng) NewRepositoriesProgressBar() *TasksWithHeadlineProg

func (*TransferProgressMng) NewRunningTimeProgressBar added in v2.29.8

func (tpm *TransferProgressMng) NewRunningTimeProgressBar() *TasksProgressBar

func (*TransferProgressMng) NewSpeedProgBar added in v2.29.8

func (tpm *TransferProgressMng) NewSpeedProgBar() *TasksProgressBar

func (*TransferProgressMng) NewTimeEstBar added in v2.29.8

func (tpm *TransferProgressMng) NewTimeEstBar() *TasksProgressBar

func (*TransferProgressMng) NewWorkingThreadsProg added in v2.29.8

func (tpm *TransferProgressMng) NewWorkingThreadsProg() *TasksProgressBar

func (*TransferProgressMng) QuitDoubleHeadLineProgWithBar added in v2.29.8

func (tpm *TransferProgressMng) QuitDoubleHeadLineProgWithBar(prog *TasksWithHeadlineProg)

func (*TransferProgressMng) StopCurrentRepoProgressBars added in v2.29.8

func (tpm *TransferProgressMng) StopCurrentRepoProgressBars(shouldStop bool)

func (*TransferProgressMng) StopGlobalProgressBars added in v2.29.8

func (tpm *TransferProgressMng) StopGlobalProgressBars()

func (*TransferProgressMng) WaitForPhasesGoRoutinesToFinish added in v2.29.8

func (tpm *TransferProgressMng) WaitForPhasesGoRoutinesToFinish()

func (*TransferProgressMng) WaitForReposGoRoutineToFinish added in v2.29.8

func (tpm *TransferProgressMng) WaitForReposGoRoutineToFinish()

Jump to

Keyboard shortcuts

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