Documentation
¶
Index ¶
- func EmptyValueOrDefault(value, defaultValue string) string
- func FormatAge(t time.Time) string
- func FormatStatus(installed bool) string
- func FormatTimestamp(t time.Time) string
- func FormatTimestampShort(t time.Time) string
- func PrintError(message string)
- func PrintInfo(message string)
- func PrintSuccess(message string)
- func PrintTable(headers []string, rows [][]string, opts ...Option) error
- func PrintWarning(message string)
- func TruncateString(s string, maxLen int) string
- type Option
- type OutputType
- type Printer
- type TablePrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyValueOrDefault ¶
EmptyValueOrDefault returns the value or a default placeholder
func FormatAge ¶
FormatAge formats time.Duration as a kubectl-style age string (e.g., "5d", "3h", "45m")
func FormatStatus ¶
FormatStatus returns a status string with kubectl-style formatting
func FormatTimestamp ¶
FormatTimestamp formats a timestamp in kubectl style
func FormatTimestampShort ¶
FormatTimestampShort formats a timestamp in short format
func PrintSuccess ¶
func PrintSuccess(message string)
PrintSuccess prints a success message with kubectl-style formatting
func PrintTable ¶
PrintTable is a convenience function for simple table printing
func TruncateString ¶
TruncateString truncates a string to maxLen with ellipsis
Types ¶
type OutputType ¶
type OutputType string
OutputType defines the output format
const ( // OutputTypeTable outputs in table format (default) OutputTypeTable OutputType = "table" // OutputTypeWide outputs in table format with additional columns OutputTypeWide OutputType = "wide" // OutputTypeJSON outputs in JSON format OutputTypeJSON OutputType = "json" // OutputTypeYAML outputs in YAML format OutputTypeYAML OutputType = "yaml" )
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer handles various output formats
func New ¶
func New(outputType OutputType, wide bool) *Printer
New creates a new printer with the specified output type
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
TablePrinter handles formatted table output similar to kubectl
func NewTablePrinter ¶
func NewTablePrinter(out io.Writer, opts ...Option) *TablePrinter
NewTablePrinter creates a new table printer with kubectl-style formatting It uses tabwriter for clean column alignment with minimal styling
func (*TablePrinter) AddRow ¶
func (p *TablePrinter) AddRow(values ...any)
AddRow adds a data row to the table
func (*TablePrinter) Render ¶
func (p *TablePrinter) Render() error
Render outputs the formatted table
func (*TablePrinter) SetHeaders ¶
func (p *TablePrinter) SetHeaders(headers ...string)
SetHeaders sets the table headers