output

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package output provides utilities for formatting and filtering command output.

Package output provides utilities for formatting and filtering command output.

Package output provides utilities for formatting and filtering command output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyJQ

func ApplyJQ(w io.Writer, payload any, expr string) error

ApplyJQ applies a jq expression to filter and transform JSON data.

func Sanitize

func Sanitize(s string) string

Sanitize removes control characters from a string.

func SelectFields

func SelectFields(payload any, fields []string) (any, error)

SelectFields extracts only the specified fields from a payload.

func Write

func Write(w io.Writer, format Format, payload any) error

Write writes data in the specified format.

func WriteJSON

func WriteJSON(w io.Writer, payload any) error

WriteJSON writes data in JSON format.

func WriteRaw

func WriteRaw(w io.Writer, payload any) error

WriteRaw writes data in raw format.

func WriteTable

func WriteTable(w io.Writer, payload any) error

WriteTable writes data in table format.

Types

type Format

type Format string

Format represents the output format type.

const (
	// FormatJSON outputs data in JSON format.
	FormatJSON Format = "json"
	// FormatTable outputs data in table format.
	FormatTable Format = "table"
	// FormatRaw outputs data in raw format.
	FormatRaw Format = "raw"
)

Jump to

Keyboard shortcuts

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