utils

package
Version: v0.0.0-...-433fd04 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableFormatCSV   = "csv"
	TableFormatJSON  = "json"
	TableFormatTable = "table"
	TableFormatYAML  = "yaml"
)

Table list format

Variables

This section is empty.

Functions

func CancelableWait

func CancelableWait(rawOp interface{}, progress *ProgressRenderer) error

CancelableWait waits for an operation and cancel it on SIGINT/SIGTERM

func RenderTable

func RenderTable(format string, header []string, data [][]string, raw interface{}) error

RenderTable renders tabular data in various formats.

Types

type ProgressRenderer

type ProgressRenderer struct {
	Format string
	Quiet  bool
	// contains filtered or unexported fields
}

ProgressRenderer tracks the progress information

func (*ProgressRenderer) Done

func (p *ProgressRenderer) Done(msg string)

Done prints the final status and prevents any update

func (*ProgressRenderer) Update

func (p *ProgressRenderer) Update(status string)

Update changes the status message to the provided string

func (*ProgressRenderer) UpdateOp

func (p *ProgressRenderer) UpdateOp(op api.Operation)

UpdateOp is a helper to update the status using a LXD API operation

func (*ProgressRenderer) UpdateProgress

func (p *ProgressRenderer) UpdateProgress(progress ioprogress.ProgressData)

UpdateProgress is a helper to update the status using an iopgress instance

func (*ProgressRenderer) Warn

func (p *ProgressRenderer) Warn(status string, timeout time.Duration)

Warn shows a temporary message instead of the status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL