Documentation ¶
Index ¶
- Constants
- Variables
- type Color
- type ProgressBarMng
- func (bm *ProgressBarMng) DoneTask(prog *tasksWithHeadlineProg)
- 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) *tasksProgressBar
- func (bm *ProgressBarMng) NewTasksWithHeadlineProg(totalTasks int64, headline string, spinner bool, color Color) *tasksWithHeadlineProg
- type TransferProgressMng
- func (t *TransferProgressMng) AddPhase1(tasksPhase1 int64)
- func (t *TransferProgressMng) AddPhase2(tasksPhase2 int64)
- func (t *TransferProgressMng) DonePhase(id int) error
- func (t *TransferProgressMng) IncrementPhase(id int) error
- func (t *TransferProgressMng) IncrementPhaseBy(id, n int) error
- func (t *TransferProgressMng) NewRepository(name string)
- func (t *TransferProgressMng) Quit() error
- func (t *TransferProgressMng) RemoveRepository()
- func (t *TransferProgressMng) SetRunningThreads(n int)
- func (t *TransferProgressMng) ShouldDisplay() bool
- func (t *TransferProgressMng) StopGracefully()
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) 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) *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()
func (*TransferProgressMng) SetRunningThreads ¶ added in v2.19.0
func (t *TransferProgressMng) SetRunningThreads(n int)
func (*TransferProgressMng) ShouldDisplay ¶ added in v2.19.0
func (t *TransferProgressMng) ShouldDisplay() bool
func (*TransferProgressMng) StopGracefully ¶ added in v2.19.0
func (t *TransferProgressMng) StopGracefully()