out

package
v1.10.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// Stdout is exported for tests
	Stdout io.Writer = os.Stdout
	// Stderr is exported for tests
	Stderr io.Writer = os.Stderr
)

Functions

func AddPrefix

func AddPrefix(ctx context.Context, prefix string) context.Context

AddPrefix returns a context with the given prefix added to end of the existing prefix

func Black

func Black(ctx context.Context, format string, args ...interface{})

Black prints the string in black

func Blue

func Blue(ctx context.Context, format string, args ...interface{})

Blue prints the string in blue

func Cyan

func Cyan(ctx context.Context, format string, args ...interface{})

Cyan prints the string in cyan

func Error

func Error(ctx context.Context, format string, args ...interface{})

Error prints the string in red to stderr

func Green

func Green(ctx context.Context, format string, args ...interface{})

Green prints the string in green

func HasNewline

func HasNewline(ctx context.Context) bool

HasNewline returns the value of newline or the default (true)

func IsHidden added in v1.10.0

func IsHidden(ctx context.Context) bool

IsHidden returns true if any output should be hidden in this context

func Magenta

func Magenta(ctx context.Context, format string, args ...interface{})

Magenta prints the string in magenta

func Prefix

func Prefix(ctx context.Context) string

Prefix returns the prefix or an empty string

func Print

func Print(ctx context.Context, format string, args ...interface{})

Print formats and prints the given string

func Red

func Red(ctx context.Context, format string, args ...interface{})

Red prints the string in red

func White

func White(ctx context.Context, format string, args ...interface{})

White prints the string in white

func WithHidden added in v1.10.0

func WithHidden(ctx context.Context, hidden bool) context.Context

WithHidden returns a context with the flag value for hidden set

func WithNewline

func WithNewline(ctx context.Context, nl bool) context.Context

WithNewline returns a context with the flag value for newline set

func WithPrefix

func WithPrefix(ctx context.Context, prefix string) context.Context

WithPrefix returns a context with the given prefix set

func Yellow

func Yellow(ctx context.Context, format string, args ...interface{})

Yellow prints the string in yellow

Types

type ProgressBar added in v1.10.0

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

ProgressBar is a gopass progress bar

Example
ctx := context.Background()
max := 100
pb := NewProgressBar(ctx, int64(max))
for i := 0; i < max+20; i++ {
	pb.Inc()
	time.Sleep(150 * time.Millisecond)
}
time.Sleep(5 * time.Second)
pb.Done()
Output:

func NewProgressBar added in v1.10.0

func NewProgressBar(ctx context.Context, total int64) *ProgressBar

NewProgressBar creates a new progress bar

func (*ProgressBar) Clear added in v1.10.0

func (p *ProgressBar) Clear()

Clear removes the progress bar

func (*ProgressBar) Done added in v1.10.0

func (p *ProgressBar) Done()

Done finalizes the progress bar

func (*ProgressBar) Inc added in v1.10.0

func (p *ProgressBar) Inc()

Inc adds one to the progress

func (*ProgressBar) Set added in v1.10.0

func (p *ProgressBar) Set(v int64)

Set sets an arbitrary progress

Jump to

Keyboard shortcuts

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