formatter

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerStatus

func ContainerStatus(ctx context.Context, c containerd.Container) string

func Ellipsis

func Ellipsis(str string, maxDisplayWidth int) string

func FormatLabels

func FormatLabels(labelMap map[string]string) string

func FormatPorts

func FormatPorts(labelMap map[string]string) string

func FormatSlice

func FormatSlice(format string, writer io.Writer, x []interface{}) error

FormatSlice formats the slice with `--format` flag.

--format="" (default): JSON --format='{{json .}}': JSON lines

FormatSlice is expected to be only used for `nerdctl OBJECT inspect` commands.

func InspectContainerCommand

func InspectContainerCommand(spec *oci.Spec, trunc, quote bool) string

func InspectContainerCommandTrunc

func InspectContainerCommandTrunc(spec *oci.Spec) string

func ParseTemplate

func ParseTemplate(format string) (*template.Template, error)

ParseTemplate wraps github.com/docker/cli/templates.Parse() to allow `json` as an alias of `{{json .}}`. ParseTemplate can be removed when https://github.com/docker/cli/pull/3355 gets merged and tagged (Docker 22.XX).

func TimeSinceInHuman

func TimeSinceInHuman(since time.Time) string

func ToJSON

func ToJSON(i interface{}, prefix string, indentation string) (string, error)

ToJSON return a string with the JSON representation of the interface{} https://github.com/docker/compose/blob/v2/cmd/formatter/json.go#L31C4-L39

Types

type Flusher

type Flusher interface {
	Flush() error
}

Flusher is implemented by text/tabwriter.Writer

Jump to

Keyboard shortcuts

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