table

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package table contains utilities for rendering tables

Index

Constants

View Source
const (
	// Simple is a simple table
	Simple = "simple"
)

Variables

This section is empty.

Functions

func BestDetail added in v0.1.0

func BestDetail(eval EvalStatus) layouts.ColoredColumn

BestDetail returns the best detail for the given evaluation status.

func GetStatusIcon added in v0.1.0

func GetStatusIcon(eval EvalStatus, emoji bool) layouts.ColoredColumn

GetStatusIcon returns a colored column with the status icon for the given evaluation status.

Types

type EvalStatus added in v0.1.0

type EvalStatus interface {
	GetStatus() string
	GetStatusDetail() string
	GetRemediationStatus() string
	GetRemediationDetail() string
	GetAlert() StatusDetails
}

EvalStatus provides an abstract interface for reading evaluation status. Since we don't have common shapes between e.g. EvaluationHistory and RuleEvaluationStatus, we use an interface modeled on RuleEvaluationStatus to adapt the two. (We would use the EvaluationHistory shape, but the sub-message return values are structs that don't match the interface here.)

type StatusDetails added in v0.1.0

type StatusDetails interface {
	GetStatus() string
	GetDetails() string
}

StatusDetails provides an abstract interface for reading status details. This is currently only used for Alert status, because those structures consistently expose this pattern.

type Table

type Table interface {
	AddRow(row ...string)
	AddRowWithColor(row ...layouts.ColoredColumn)
	// Render outputs the table to stdout (TODO: make output configurable)
	Render()
	// SeparateRows ensures each row is clearly separated (probably because it is multi-line)
	SeparateRows()
}

Table is an interface for rendering tables

func New

func New(_ string, _ layouts.TableLayout, header []string) Table

New creates a new table

Directories

Path Synopsis
Package layouts defines the available table layouts
Package layouts defines the available table layouts

Jump to

Keyboard shortcuts

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