formatter

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(err error) string

FormatError formats an error message

func FormatOutput

func FormatOutput(data interface{}, format OutputFormat) (string, error)

FormatOutput formats the output based on the specified format

func FormatSuccess

func FormatSuccess(message string, data interface{}) (string, error)

FormatSuccess formats a success message with optional data

func ToJSON

func ToJSON(data interface{}) (string, error)

ToJSON formats data as JSON

func ToTable

func ToTable(data interface{}) (string, error)

ToTable formats data as a table

func ToYAML

func ToYAML(data interface{}) (string, error)

ToYAML formats data as YAML

Types

type OutputFormat

type OutputFormat string

OutputFormat represents the output format type

const (
	// FormatJSON outputs in JSON format
	FormatJSON OutputFormat = "json"
	// FormatTable outputs in table format
	FormatTable OutputFormat = "table"
	// FormatYAML outputs in YAML format
	FormatYAML OutputFormat = "yaml"
)

Jump to

Keyboard shortcuts

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