print

package
v0.15.83 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package print provides JSON, YAML, table, and text printers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(w io.Writer, value any)

JSON prints value to out

func Map

func Map(w io.Writer, header []string, vals map[string]string)

Map prints map

func Object

func Object(w io.Writer, format string, value any)

Object prints value to out in format

func Print

func Print(w io.Writer, value any)

Print value

func RegisterType

func RegisterType(typ any, printFunc CustomFn)

RegisterType allows registering a custom print function for a specific type.

func Strings

func Strings(w io.Writer, res []string)

Strings prints strings

func Text added in v0.12.55

func Text(w io.Writer, doc string, indent string, noFirstIndent bool)

Text prints text with indentation, keeping the first line without indentation if noFirstIndent is true

func TextOneLine added in v0.12.55

func TextOneLine(w io.Writer, doc string)

TextOneLine prints documentation text in one line

func Yaml

func Yaml(w io.Writer, value any)

Yaml prints value to out

Types

type CustomFn added in v0.15.78

type CustomFn func(io.Writer, any)

CustomFn is a custom print function for a specific type. It takes precedence over the default print functions.

func FindRegistered added in v0.15.78

func FindRegistered(val any) (CustomFn, bool)

FindRegistered finds a custom print function for a specific value.

func FindRegisteredType added in v0.15.78

func FindRegisteredType(typ reflect.Type) (CustomFn, bool)

FindRegisteredType finds a custom print function for a specific type.

type Printer

type Printer interface {
	Print(w io.Writer)
}

Jump to

Keyboard shortcuts

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