output

package
v0.0.0-...-730ea19 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Red    = color.New(color.FgRed).SprintFunc()
	Yellow = color.New(color.FgYellow).SprintFunc()
	Green  = color.New(color.FgGreen).SprintFunc()
	Blue   = color.New(color.FgBlue).SprintFunc()
	Dim    = color.New(color.Faint).SprintFunc()
	Bold   = color.New(color.Bold).SprintFunc()
)

Color helpers

Functions

func FormatTime

func FormatTime(t string) string

FormatTime formats a timestamp for display.

func JSON

func JSON(data any) error

JSON outputs data as JSON.

func LevelColor

func LevelColor(level string) string

LevelColor returns colored level string.

func ParseSince

func ParseSince(s string) (int, error)

ParseSince converts "24h", "7d", "2w" to hours.

func RelativeTime

func RelativeTime(t string) string

RelativeTime returns a human-readable relative time.

func StatusColor

func StatusColor(status string) string

StatusColor returns colored status string.

func Truncate

func Truncate(s string, max int) string

Truncate shortens a string to max length.

Types

type TableWriter

type TableWriter struct {
	// contains filtered or unexported fields
}

TableWriter wraps tablewriter.Table with a simpler API.

func Table

func Table(headers []string) *TableWriter

Table creates a new table writer with headers.

func (*TableWriter) Append

func (t *TableWriter) Append(row []string)

Append adds a row to the table.

func (*TableWriter) Render

func (t *TableWriter) Render()

Render outputs the table.

Jump to

Keyboard shortcuts

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