Documentation
¶
Overview ¶
Package progress provides common progress monitoring / display features NOTE: Subject to change, do not rely on this package from outside git-lfs source
Index ¶
- func DryRun(dryRun bool) meterOption
- func WithLogFile(name string) meterOption
- func WithOSEnv(os env) meterOption
- type BodyWithCallback
- type CallbackReader
- type CopyCallback
- type Meter
- type ProgressMeter
- func (p *ProgressMeter) Add(size int64)
- func (p *ProgressMeter) Finish()
- func (p *ProgressMeter) FinishTransfer(name string)
- func (p *ProgressMeter) Pause()
- func (p *ProgressMeter) Skip(size int64)
- func (p *ProgressMeter) Start()
- func (p *ProgressMeter) StartTransfer(name string)
- func (p *ProgressMeter) TransferBytes(direction, name string, read, total int64, current int)
- type ReadSeekCloser
- type Spinner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DryRun ¶
func DryRun(dryRun bool) meterOption
DryRun is an option for NewMeter() that determines whether updates should be sent to stdout.
func WithLogFile ¶
func WithLogFile(name string) meterOption
WithLogFile is an option for NewMeter() that sends updates to a text file.
Types ¶
type BodyWithCallback ¶
type BodyWithCallback struct { ReadSeekCloser // contains filtered or unexported fields }
func NewBodyWithCallback ¶
func NewBodyWithCallback(body ReadSeekCloser, totalSize int64, cb CopyCallback) *BodyWithCallback
func NewByteBodyWithCallback ¶
func NewByteBodyWithCallback(by []byte, totalSize int64, cb CopyCallback) *BodyWithCallback
func (*BodyWithCallback) Read ¶
func (r *BodyWithCallback) Read(p []byte) (int, error)
Read wraps the underlying Reader's "Read" method. It also captures the number of bytes read, and calls the callback.
func (*BodyWithCallback) ResetProgress ¶
func (r *BodyWithCallback) ResetProgress() error
ResetProgress calls the callback with a negative read size equal to the total number of bytes read so far, effectively "resetting" the progress.
type CallbackReader ¶
type CallbackReader struct { C CopyCallback TotalSize int64 ReadSize int64 io.Reader }
type CopyCallback ¶
type Meter ¶
type ProgressMeter ¶
type ProgressMeter struct {
// contains filtered or unexported fields
}
ProgressMeter provides a progress bar type output for the TransferQueue. It is given an estimated file count and size up front and tracks the number of files and bytes transferred as well as the number of files and bytes that get skipped because the transfer is unnecessary.
func NewMeter ¶
func NewMeter(options ...meterOption) *ProgressMeter
NewMeter creates a new ProgressMeter.
func (*ProgressMeter) Add ¶
func (p *ProgressMeter) Add(size int64)
Add tells the progress meter that a single file of the given size will possibly be transferred. If a file doesn't need to be transferred for some reason, be sure to call Skip(int64) with the same size.
func (*ProgressMeter) FinishTransfer ¶
func (p *ProgressMeter) FinishTransfer(name string)
FinishTransfer increments the finished transfer count
func (*ProgressMeter) Pause ¶
func (p *ProgressMeter) Pause()
Pause stops sending status updates temporarily, until Start() is called again.
func (*ProgressMeter) Skip ¶
func (p *ProgressMeter) Skip(size int64)
Skip tells the progress meter that a file of size `size` is being skipped because the transfer is unnecessary.
func (*ProgressMeter) Start ¶
func (p *ProgressMeter) Start()
Start begins sending status updates to the optional log file, and stdout.
func (*ProgressMeter) StartTransfer ¶
func (p *ProgressMeter) StartTransfer(name string)
StartTransfer tells the progress meter that a transferring file is being added to the TransferQueue.
func (*ProgressMeter) TransferBytes ¶
func (p *ProgressMeter) TransferBytes(direction, name string, read, total int64, current int)
TransferBytes increments the number of bytes transferred
type ReadSeekCloser ¶
type ReadSeekCloser interface { io.Seeker io.ReadCloser }
prevent import cycle
func NewByteBody ¶
func NewByteBody(by []byte) ReadSeekCloser
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Indeterminate progress indicator 'spinner'
func NewSpinner ¶
func NewSpinner() *Spinner