formatter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteTo

func WriteTo(f Formatter, containers []docker.Container, stats docker.Stats) error

WriteTo is a convenience that formats to stdout.

Types

type Formatter

type Formatter interface {
	Format(w io.Writer, containers []docker.Container, stats docker.Stats) error
}

Formatter writes container data to output.

type Includes

type Includes struct {
	ContainerID bool // n
	Image       bool // i
	Command     bool // m
	Created     bool // c
	Status      bool // s
	Ports       bool // p
	Health      bool // h
}

Includes defines which optional columns to display.

func ParseIncludes

func ParseIncludes(s string, slim bool) Includes

ParseIncludes converts a shorthand string like "cp" into an Includes struct. An empty string means "show all default columns".

type JSONFormatter

type JSONFormatter struct{}

JSONFormatter outputs container data as JSON.

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(w io.Writer, containers []docker.Container, stats docker.Stats) error

type PrettyFormatter

type PrettyFormatter struct {
	Includes Includes
}

PrettyFormatter renders containers as bordered cards with status indicators.

func (*PrettyFormatter) Format

func (f *PrettyFormatter) Format(w io.Writer, containers []docker.Container, stats docker.Stats) error

type SlimFormatter

type SlimFormatter struct {
	Includes Includes
}

SlimFormatter renders a minimal status-dot + name list, with optional detail rows.

func (*SlimFormatter) Format

func (f *SlimFormatter) Format(w io.Writer, containers []docker.Container, stats docker.Stats) error

Jump to

Keyboard shortcuts

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