columns

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagName       = "columns"
	MaxColumnWidth = 40
)

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(flags *pflag.FlagSet)

AddFlags adds custom text-column selection to a command flag set.

func Project

func Project(raw any, columns []Column) ([]string, [][]string, error)

Project converts raw structured output into headers and text rows.

func Render

func Render(out io.Writer, headers []string, rows [][]string, availableWidth int) error

Render writes a plain, aligned table with display-width-aware truncation.

func RenderAutoWidth

func RenderAutoWidth(out io.Writer, headers []string, rows [][]string) error

RenderAutoWidth detects the output terminal width and falls back to 120 columns when the output does not expose a terminal file descriptor.

Types

type Column

type Column struct {
	Header string
	Path   string
	// contains filtered or unexported fields
}

Column is a user-selected text column and its compiled field path.

func Parse

func Parse(values []string) ([]Column, error)

Parse compiles repeated or comma-separated HEADER=.field specifications.

func Resolve

func Resolve(cmd *cobra.Command, outType cmdcommon.OutputFormat) ([]Column, error)

Resolve reads and validates custom columns from cmd. An empty result means the command should use its built-in text columns.

Jump to

Keyboard shortcuts

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