table

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package table provides common table formatting utilities for CLI commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAuthorsString

func BuildAuthorsString(authors []catalogs.Author) string

BuildAuthorsString creates a comma-separated list of author names.

func BuildFeaturesString

func BuildFeaturesString(model *catalogs.Model) string

BuildFeaturesString creates a comma-separated list of model features.

func FormatNumber

func FormatNumber(n int64) string

FormatNumber formats large numbers with comma separators.

func FormatOutput

func FormatOutput(limits *catalogs.ModelLimits) string

FormatOutput formats output token limit information.

func FormatPrice

func FormatPrice(pricing *catalogs.ModelPricing, input bool) string

FormatPrice formats pricing information.

func FormatTokens

func FormatTokens(limits *catalogs.ModelLimits) string

FormatTokens formats context window information.

func MatchField added in v0.0.23

func MatchField(field string, patterns []string) bool

MatchField checks if a field matches any of the provided patterns. Supports wildcard matching (e.g., "pricing.*" matches "Pricing.Tokens.Input"). Matching is case-insensitive for better user experience.

Types

type Align added in v0.0.16

type Align int

Align represents column alignment in tables.

const (
	// AlignDefault uses the default alignment (skip).
	AlignDefault Align = iota
	// AlignLeft aligns content to the left.
	AlignLeft
	// AlignCenter centers content.
	AlignCenter
	// AlignRight aligns content to the right.
	AlignRight
)

type Data

type Data struct {
	Headers         []string
	Rows            [][]string
	ColumnAlignment []Align // Optional: column alignment
}

Data represents table formatting data to avoid import cycles.

func AuthorsToTableData

func AuthorsToTableData(authors []*catalogs.Author) Data

AuthorsToTableData converts authors to table format.

func ModelsToTableData

func ModelsToTableData(models []*catalogs.Model, showDetails bool) Data

ModelsToTableData converts models to table format.

func ProvenanceToTableData added in v0.0.23

func ProvenanceToTableData(fieldProvenance map[string][]provenance.Provenance) Data

ProvenanceToTableData converts provenance history to table format. Shows all fields and their history in a single unified table.

func ProvidersToTableData

func ProvidersToTableData(providers []*catalogs.Provider, checker *auth.Checker, supportedMap map[string]bool) Data

ProvidersToTableData converts providers to table format.

Jump to

Keyboard shortcuts

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