utils

package
v0.0.0-...-f596937 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package utils handles fancy utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToReadable

func BytesToReadable(bytes int64) string

BytesToReadable formats a byte count into a human readable representation.

func Error

func Error(message string, args ...interface{}) error

Error is a helper function to format the error results.

func ErrorExit

func ErrorExit(cmd *cobra.Command, message string, args ...interface{}) error

ErrorExit is a helper function to format the error result of a command execution.

func GofishClient

func GofishClient(connection string) (*gofish.APIClient, error)

GofishClient will get a gofish client connection for the requested system. If connection == "", then the default system will be retrieved. The caller should close the client connection when done.

func RenderTable

func RenderTable(rawJSON []byte, rows [][]string)

RenderTable will print out data from the json passed in and the rows that we want printed

func RenderTableList

func RenderTableList(rawJSON []byte, columns []string, sortColumn string)

RenderTableList will print out a table based on the json and json selectors passed in

Types

type TableOutputWriter

type TableOutputWriter interface {
	SetHeaders(headers ...string)
	AddRow(items ...interface{})
	Render()
	RowCount() int
}

TableOutputWriter is the interface to write out tables

func NewTableWriter

func NewTableWriter(output io.Writer, headers ...string) TableOutputWriter

NewTableWriter gets a new instance of our table output writer.

Jump to

Keyboard shortcuts

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