progressbar

package
v2.18.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: Apache-2.0 Imports: 16 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) 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) 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) *tasksProgressBar

func (*ProgressBarMng) NewTasksWithHeadlineProg

func (bm *ProgressBarMng) NewTasksWithHeadlineProg(totalTasks int64, headline string, spinner bool, color Color) *tasksWithHeadlineProg

type TransferProgressMng

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

TransferProgressMng provides progress indication for the jf rt transfer-files command. Transferring one repository's data at a time.

func NewTransferProgressMng

func NewTransferProgressMng(totalRepositories int64) (*TransferProgressMng, error)

NewTransferProgressMng creates TransferProgressMng object. If the progress bar shouldn't be displayed returns nil.

func (*TransferProgressMng) AddPhase1

func (t *TransferProgressMng) AddPhase1(tasksPhase1 int64)

func (*TransferProgressMng) AddPhase2

func (t *TransferProgressMng) AddPhase2(tasksPhase2 int64)

func (*TransferProgressMng) DonePhase

func (t *TransferProgressMng) DonePhase(id int) error

func (*TransferProgressMng) IncrementPhase

func (t *TransferProgressMng) IncrementPhase(id int) error

IncrementPhase increments completed tasks count for a specific phase by 1.

func (*TransferProgressMng) IncrementPhaseBy

func (t *TransferProgressMng) IncrementPhaseBy(id, n int) error

IncrementPhaseBy increments completed tasks count for a specific phase by n.

func (*TransferProgressMng) NewRepository

func (t *TransferProgressMng) NewRepository(name string)

NewRepository adds new repository's progress details. Aborting previous repository if exists.

func (*TransferProgressMng) Quit

func (t *TransferProgressMng) Quit() error

Quit terminate the TransferProgressMng process.

func (*TransferProgressMng) RemoveRepository

func (t *TransferProgressMng) RemoveRepository()

Jump to

Keyboard shortcuts

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