Documentation
¶
Index ¶
- func DefaultBytes(size int64, desc string, options ...progressbar.Option) io.WriteCloser
- func FromReader(r io.Reader, description string) io.ReadCloser
- func FromReaderWithOptions(r io.Reader, options ...progressbar.Option) io.ReadCloser
- func FromWriter(w io.Writer, description string) io.WriteCloser
- func FromWriterWithOptions(w io.Writer, options ...progressbar.Option) io.WriteCloser
- type RateLimitedLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBytes ¶
func DefaultBytes(size int64, desc string, options ...progressbar.Option) io.WriteCloser
DefaultBytes is the terminal-safe equivalent of progressbar.DefaultBytes.
func FromReader ¶
func FromReader(r io.Reader, description string) io.ReadCloser
FromReader creates a new terminal-safe progress bar for reading from the given io.Reader.
If given an os.File, its name and size will be used to provide extra information about read progress. The description argument can include `{name}` or `{basename}` which will be replaced with the actual file's name accordingly.
If there is no terminal, an instance of RateLimitedLogger is returned.
func FromReaderWithOptions ¶
func FromReaderWithOptions(r io.Reader, options ...progressbar.Option) io.ReadCloser
FromReaderWithOptions is a variant of FromReader that gives caller more customisation options over the progress bar.
func FromWriter ¶
func FromWriter(w io.Writer, description string) io.WriteCloser
FromWriter creates a new terminal-safe progress bar for writing to the given io.Writer.
If given an os.File, its name and size will be used to provide extra information about read progress. The description argument can include `{name}` or `{basename}` which will be replaced with the actual file's name accordingly.
If there is no terminal, an instance of RateLimitedLogger is returned.
func FromWriterWithOptions ¶
func FromWriterWithOptions(w io.Writer, options ...progressbar.Option) io.WriteCloser
FromWriterWithOptions is a variant of FromWriter that gives caller more customisation options over the progress bar.
Types ¶
type RateLimitedLogger ¶
type RateLimitedLogger struct { // Rate indicates how often logging is performed. // // By default, only log every 10 seconds. Rate *rate.Sometimes // Logger is the log.Logger instance that is used for logging. // // Defaults to log.Default. Logger *log.Logger // contains filtered or unexported fields }
RateLimitedLogger is the replacement of progressbar.ProgressBar if program is not running in terminal.
func (*RateLimitedLogger) Close ¶
func (l *RateLimitedLogger) Close() error