github.com/jfrog/jfrog-cli-core/v2@v2.51.0/common/progressbar/simpleprogressbar.go (about)

     1  package progressbar
     2  
     3  import (
     4  	"io"
     5  )
     6  
     7  type SimpleProgressBar struct {
     8  	*progressBarUnit
     9  	Id int
    10  }
    11  
    12  // Used to update the progress bar progress.
    13  func (p *SimpleProgressBar) ActionWithProgress(reader io.Reader) (results io.Reader) {
    14  	p.bar.Increment()
    15  	return nil
    16  }
    17  
    18  func (p *SimpleProgressBar) SetProgress(progress int64) {
    19  	p.bar.SetCurrent(progress)
    20  }
    21  
    22  // Abort aborts a progress indicator. Called on both successful and unsuccessful operations
    23  func (p *SimpleProgressBar) Abort() {
    24  	p.bar.Abort(true)
    25  }
    26  
    27  // GetId Returns the ProgressBar ID
    28  //
    29  //nolint:gocritic
    30  func (p *SimpleProgressBar) GetId() (Id int) {
    31  	return p.Id
    32  }
    33  
    34  func (p *SimpleProgressBar) getProgressBarUnit() (unit *progressBarUnit) {
    35  	return p.progressBarUnit
    36  }