Documentation
¶
Index ¶
- Constants
- func AddFormatFlag(cmd *cobra.Command, defaultFormat string)
- func DisplayResults(cmd *cobra.Command, resp *models.ResultsResponse) error
- func FormatBytes(b int64) string
- func FormatFromCmd(cmd *cobra.Command) string
- func FormatUSD(v float64) string
- func PrintJSON(w io.Writer, v any) error
- func PrintTable(w io.Writer, columns []string, rows [][]string)
- func ResultRowsToStrings(rows []map[string]any, columns []string) [][]string
Constants ¶
View Source
const ( FormatText = "text" FormatJSON = "json" )
Variables ¶
This section is empty.
Functions ¶
func AddFormatFlag ¶
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 ¶
FormatBytes returns a human-readable byte size string (e.g. "1.2 GB").
func FormatFromCmd ¶
FormatFromCmd reads the output flag value from cmd.
func PrintTable ¶
PrintTable writes columns and rows as aligned text using tabwriter.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.