lxd: github.com/lxc/lxd/lxc/utils Index | Files

package utils

import "github.com/lxc/lxd/lxc/utils"


Package Files

cancel.go progress.go table.go


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

Table list format

func CancelableWait Uses

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

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

func RenderTable Uses

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

RenderTable renders tabular data in various formats.

type ProgressRenderer Uses

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

ProgressRenderer tracks the progress information

func (*ProgressRenderer) Done Uses

func (p *ProgressRenderer) Done(msg string)

Done prints the final status and prevents any update

func (*ProgressRenderer) Update Uses

func (p *ProgressRenderer) Update(status string)

Update changes the status message to the provided string

func (*ProgressRenderer) UpdateOp Uses

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

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

func (*ProgressRenderer) UpdateProgress Uses

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

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

func (*ProgressRenderer) Warn Uses

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

Warn shows a temporary message instead of the status

Package utils imports 15 packages (graph) and is imported by 23 packages. Updated 2019-12-08. Refresh now. Tools for package owners.