Documentation ¶
Index ¶
- Constants
- func CancelableWait(rawOp any, progress *ProgressRenderer) error
- func FormatSection(header string, content string) string
- func RenderTable(format string, header []string, data [][]string, raw any) error
- type ByNameAndType
- type Column
- type ProgressRenderer
- type SortColumnsNaturally
- type StringList
Constants ¶
const ( TableFormatCSV = "csv" TableFormatJSON = "json" TableFormatTable = "table" TableFormatYAML = "yaml" TableFormatCompact = "compact" )
Table list format.
const (
// TableOptionNoHeader hides the table header when possible.
TableOptionNoHeader = "noheader"
)
Variables ¶
This section is empty.
Functions ¶
func CancelableWait ¶
func CancelableWait(rawOp any, progress *ProgressRenderer) error
CancelableWait waits for an operation and cancel it on SIGINT/SIGTERM.
func FormatSection ¶
FormatSection properly indents a text section.
Types ¶
type ByNameAndType ¶
type ByNameAndType [][]string
ByNameAndType represents the type for sorting Storage volumes.
func (ByNameAndType) Len ¶
func (a ByNameAndType) Len() int
func (ByNameAndType) Less ¶
func (a ByNameAndType) Less(i, j int) bool
func (ByNameAndType) Swap ¶
func (a ByNameAndType) Swap(i, j int)
type Column ¶
type Column struct { Header string // DataFunc is a method to retrieve data for this column. The argument to this function will be an element of the // "data" slice that is passed into RenderSlice. DataFunc func(any) (string, error) }
Column represents a single column in a table.
type ProgressRenderer ¶
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 REST API operation.
func (*ProgressRenderer) UpdateProgress ¶
func (p *ProgressRenderer) UpdateProgress(progress ioprogress.ProgressData)
UpdateProgress is a helper to update the status using an iopgress instance.
type SortColumnsNaturally ¶
type SortColumnsNaturally [][]string
SortColumnsNaturally represents the type for sorting columns in a natural order from left to right.
func (SortColumnsNaturally) Len ¶
func (a SortColumnsNaturally) Len() int
func (SortColumnsNaturally) Less ¶
func (a SortColumnsNaturally) Less(i, j int) bool
func (SortColumnsNaturally) Swap ¶
func (a SortColumnsNaturally) Swap(i, j int)
type StringList ¶
type StringList [][]string
StringList represents the type for sorting nested string lists.
func (StringList) Len ¶
func (a StringList) Len() int
func (StringList) Less ¶
func (a StringList) Less(i, j int) bool
func (StringList) Swap ¶
func (a StringList) Swap(i, j int)