format

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package format provides output format abstraction for CLI commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v any, f Format) ([]byte, error)

Marshal serializes v to the specified format.

Types

type Format

type Format string

Format represents an output format type.

const (
	TOON        Format = "toon"
	JSON        Format = "json"
	JSONCompact Format = "json-compact"
)

Supported output formats.

func Parse

func Parse(s string) (Format, error)

Parse parses a format string into a Format type. Empty string defaults to TOON.

func (Format) String

func (f Format) String() string

String returns the string representation of the format.

Jump to

Keyboard shortcuts

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