output

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	FormatText = "text"
	FormatJSON = "json"
)

Variables

This section is empty.

Functions

func AddFormatFlag

func AddFormatFlag(cmd *cobra.Command, defaultFormat string)

AddFormatFlag registers the -o/--output flag on cmd with the given default.

func DisplayResults

func DisplayResults(cmd *cobra.Command, resp *models.ResultsResponse) error

DisplayResults renders a ResultsResponse as JSON or table based on cmd flags.

func FormatBytes

func FormatBytes(b int64) string

FormatBytes returns a human-readable byte size string (e.g. "1.2 GB").

func FormatFromCmd

func FormatFromCmd(cmd *cobra.Command) string

FormatFromCmd reads the output flag value from cmd.

func FormatUSD added in v0.1.6

func FormatUSD(v float64) string

FormatUSD formats a USD value for display with 2 decimal places.

func PrintJSON

func PrintJSON(w io.Writer, v any) error

PrintJSON encodes v as indented JSON and writes it to w.

func PrintTable

func PrintTable(w io.Writer, columns []string, rows [][]string)

PrintTable writes columns and rows as aligned text using tabwriter.

func ResultRowsToStrings

func ResultRowsToStrings(rows []map[string]any, columns []string) [][]string

ResultRowsToStrings converts result rows to a string grid using column ordering.

Types

This section is empty.

Jump to

Keyboard shortcuts

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