ui

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup struct {
	*Message
	*StdioWrapper

	MinUpdatePause time.Duration
	// contains filtered or unexported fields
}

Backup reports progress for the `backup` command.

func NewBackup

func NewBackup(term *termstatus.Terminal, verbosity uint) *Backup

NewBackup returns a new backup progress reporter.

func (*Backup) CompleteBlob

func (b *Backup) CompleteBlob(filename string, bytes uint64)

CompleteBlob is called for all saved blobs for files.

func (*Backup) CompleteItem added in v0.9.5

func (b *Backup) CompleteItem(item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)

CompleteItem is the status callback function for the archiver when a file/dir has been saved successfully.

func (*Backup) Error

func (b *Backup) Error(item string, fi os.FileInfo, err error) error

Error is the error callback function for the archiver, it prints the error and returns nil.

func (*Backup) Finish

func (b *Backup) Finish(snapshotID restic.ID)

Finish prints the finishing messages.

func (*Backup) ReportTotal

func (b *Backup) ReportTotal(item string, s archiver.ScanStats)

ReportTotal sets the total stats up to now

func (*Backup) Run

func (b *Backup) Run(ctx context.Context) error

Run regularly updates the status lines. It should be called in a separate goroutine.

func (*Backup) ScannerError

func (b *Backup) ScannerError(item string, fi os.FileInfo, err error) error

ScannerError is the error callback function for the scanner, it prints the error in verbose mode and returns nil.

func (*Backup) SetMinUpdatePause added in v0.9.5

func (b *Backup) SetMinUpdatePause(d time.Duration)

SetMinUpdatePause sets b.MinUpdatePause. It satisfies the ArchiveProgressReporter interface.

func (*Backup) StartFile

func (b *Backup) StartFile(filename string)

StartFile is called when a file is being processed by a worker.

type Message

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

Message reports progress with messages of different verbosity.

func NewMessage

func NewMessage(term *termstatus.Terminal, verbosity uint) *Message

NewMessage returns a message progress reporter with underlying terminal term.

func (*Message) E

func (m *Message) E(msg string, args ...interface{})

E reports an error

func (*Message) P

func (m *Message) P(msg string, args ...interface{})

P prints a message if verbosity >= 1, this is used for normal messages which are not errors.

func (*Message) V

func (m *Message) V(msg string, args ...interface{})

V prints a message if verbosity >= 2, this is used for verbose messages.

func (*Message) VV

func (m *Message) VV(msg string, args ...interface{})

VV prints a message if verbosity >= 3, this is used for debug messages.

type StdioWrapper

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

StdioWrapper provides stdout and stderr integration with termstatus.

func NewStdioWrapper

func NewStdioWrapper(term *termstatus.Terminal) *StdioWrapper

NewStdioWrapper initializes a new stdio wrapper that can be used in place of os.Stdout or os.Stderr.

func (*StdioWrapper) Stderr

func (w *StdioWrapper) Stderr() io.WriteCloser

Stderr returns a writer that is line buffered and can be used in place of os.Stderr. On Close(), the remaining bytes are written, followed by a line break.

func (*StdioWrapper) Stdout

func (w *StdioWrapper) Stdout() io.WriteCloser

Stdout returns a writer that is line buffered and can be used in place of os.Stdout. On Close(), the remaining bytes are written, followed by a line break.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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