progressbar

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package progressbar provides a simple progress bar for the CLI. This should have been called "loadingbar" instead as there is no progress at all.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaskFn

type MaskFn func(string) string

MaskFn is a function that masks a message. Receives a string and returns a string, the returned string is printed to the terminal.

type MessageWriter

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

MessageWriter implements io.Writer on top of a channel of strings.

func Start

func Start(opts ...Option) *MessageWriter

Start starts a progress bar.

func (*MessageWriter) Close

func (m *MessageWriter) Close()

Close closes the MessageWriter inner channel.

func (*MessageWriter) Closef

func (m *MessageWriter) Closef(format string, args ...interface{})

Closef closes the MessageWriter after writing a message.

func (*MessageWriter) Debugf

func (m *MessageWriter) Debugf(format string, args ...interface{})

Debugf is implemeted to comply with rig log.Logger interface.

func (*MessageWriter) Errorf

func (m *MessageWriter) Errorf(format string, args ...interface{})

Errorf is implemeted to comply with rig log.Logger interface.

func (*MessageWriter) Infof

func (m *MessageWriter) Infof(format string, args ...interface{})

Infof is implemeted to comply with rig log.Logger interface.

func (*MessageWriter) Tracef

func (m *MessageWriter) Tracef(format string, args ...interface{})

Tracef is implemeted to comply with rig log.Logger interface.

func (*MessageWriter) Warnf

func (m *MessageWriter) Warnf(format string, args ...interface{})

Warnf is implemeted to comply with rig log.Logger interface.

func (*MessageWriter) Write

func (m *MessageWriter) Write(p []byte) (n int, err error)

Write implements io.Writer for the MessageWriter.

type Option

type Option func(*MessageWriter)

Option is a function that sets an option on a MessageWriter.

func WithMask

func WithMask(mfn MaskFn) Option

WithMask sets the MaskFn on the MessageWriter.

func WithWriter

func WithWriter(w WriteFn) Option

WithWriter sets the WriteFn on the MessageWriter.

type WriteFn

type WriteFn func(string, ...any) (int, error)

WriteFn is a function that writes a formatted string.

Jump to

Keyboard shortcuts

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