output

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupRestoreStatus added in v0.15.0

func BackupRestoreStatus(s backupv1.BackupRestoreStatus) string

BackupRestoreStatus returns a concise label for a BackupRestoreStatus.

func BackupScheduleStatus added in v0.15.0

func BackupScheduleStatus(s backupv1.BackupScheduleStatus) string

BackupScheduleStatus returns a concise label for a BackupScheduleStatus.

func BackupStatus added in v0.15.0

func BackupStatus(s backupv1.BackupStatus) string

BackupStatus returns a concise label for a BackupStatus.

func BoolMark added in v0.16.0

func BoolMark(v bool) string

BoolMark formats a bool as "yes" or empty string ("").

func BoolYesNo added in v0.15.0

func BoolYesNo(v bool) string

BoolYesNo formats a bool as "yes" or "no".

func ClusterCreationStatus added in v0.15.0

func ClusterCreationStatus(s hybridv1.QdrantClusterCreationStatus) string

ClusterCreationStatus returns a concise label for a QdrantClusterCreationStatus.

func ClusterNodeState added in v0.15.0

func ClusterNodeState(s clusterv1.ClusterNodeState) string

ClusterNodeState returns a concise label for a ClusterNodeState.

func ClusterPhase added in v0.15.0

func ClusterPhase(p clusterv1.ClusterPhase) string

ClusterPhase returns a concise label for a ClusterPhase.

func DiffValue added in v0.10.0

func DiffValue(oldVal, newVal string) string

DiffValue formats a field value as "old => new" when the value changes, or just "val" when unchanged.

func FormatMillicents added in v0.16.0

func FormatMillicents(mc int32, currency string) string

FormatMillicents formats millicent pricing as a human-readable price string. 1 unit of currency = 100,000 millicents. Returns "free" for zero. currency should be an ISO 4217 code (e.g. "USD").

func FullDateTime

func FullDateTime(t time.Time) string

FullDateTime formats t as "2006-01-02 15:04:05 UTC". Returns empty string for zero time.

func HumanTime

func HumanTime(t time.Time) string

HumanTime returns a relative human-readable time (e.g., "3 hours ago"). Returns empty string for zero time.

func HybridComponentPhase added in v0.15.0

HybridComponentPhase returns a concise label for a HybridCloudEnvironmentComponentStatusPhase.

func HybridEnvironmentPhase added in v0.15.0

func HybridEnvironmentPhase(p hybridv1.HybridCloudEnvironmentStatusPhase) string

HybridEnvironmentPhase returns a concise label for a HybridCloudEnvironmentStatusPhase.

func OptionalValue added in v0.10.0

func OptionalValue(v any, fallback string) string

OptionalValue formats an optional pointer value as a string. Returns fallback for nil pointers. Supports any pointer type. Booleans are formatted as "yes"/"no"; all other types use their default format.

func PackageTier added in v0.15.0

func PackageTier(t bookingv1.PackageTier) string

PackageTier returns a concise label for a PackageTier.

func PrintJSON

func PrintJSON(w io.Writer, v any) error

PrintJSON marshals items as JSON and writes to w. For proto messages, uses protojson for proper field naming.

func RoleType added in v0.20.0

func RoleType(v iamv1.RoleType) string

RoleType formats a RoleType enum for display.

func TolerationEffect added in v0.15.0

func TolerationEffect(eff clusterv1.TolerationEffect) string

TolerationEffect returns a concise label for a TolerationEffect.

func TolerationOperator added in v0.15.0

func TolerationOperator(op clusterv1.TolerationOperator) string

TolerationOperator returns a concise label for a TolerationOperator.

func UserStatus added in v0.20.0

func UserStatus(x iamv1.UserStatus) string

UserStatus formats an iamv1.UserStatus enum for display.

Types

type Table

type Table[T any] struct {
	// contains filtered or unexported fields
}

Table renders items as an ASCII table.

func NewTable

func NewTable[T any](w io.Writer) *Table[T]

NewTable creates a new Table that writes to the given writer.

func (*Table[T]) AddField

func (t *Table[T]) AddField(name string, fn func(T) string)

AddField adds a column to the table with a header name and a field extraction function.

func (*Table[T]) Render added in v0.20.0

func (t *Table[T]) Render()

Render writes the table using previously stored items (via SetItems). Headers are suppressed when SetNoHeaders(true) has been called.

func (*Table[T]) SetItems added in v0.20.0

func (t *Table[T]) SetItems(items []T)

SetItems stores items for deferred rendering via Render.

func (*Table[T]) SetNoHeaders added in v0.20.0

func (t *Table[T]) SetNoHeaders(v bool)

SetNoHeaders controls whether the header row is suppressed when rendering.

func (*Table[T]) Write

func (t *Table[T]) Write(items []T)

Write renders the table with the given items immediately.

type TableRenderer added in v0.20.0

type TableRenderer interface {
	SetNoHeaders(bool)
	Render()
}

TableRenderer can render table output with configurable header suppression. Table[T] implements this interface after SetItems is called.

Jump to

Keyboard shortcuts

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