Documentation
¶
Index ¶
- Variables
- func AddOutputAndQueryFlags(cmd *cobra.Command)
- func DefaultValueFormatter(columnIndex int, width int, val interface{}) string
- func DefaultWidthFunc(value interface{}) int
- func GetOutputAndQueryValues(cmd *cobra.Command, defaultQuery string) (string, string, error)
- func GetTerminalLink(url string, displayText string) string
- func OutputResult(w io.Writer, result interface{}, outputFormat string, query string, ...) error
- func RoundtripMarshal(data interface{}) ([]interface{}, error)
- type Formatter
- type OutputFormat
- type OutputLink
- type Table
- type WidthFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultPadding specifies the number of spaces between columns in a table. DefaultPadding = 2 // DefaultWriter specifies the output io.Writer for the Table.Print method. DefaultWriter io.Writer = os.Stdout // DefaultHeaderFormatter specifies the default Formatter for the table header. DefaultHeaderFormatter Formatter )
These are the default properties for all Tables created from this package and can be modified.
Functions ¶
func AddOutputAndQueryFlags ¶
func DefaultValueFormatter ¶
func DefaultWidthFunc ¶
func DefaultWidthFunc(value interface{}) int
func GetOutputAndQueryValues ¶
func GetTerminalLink ¶
func OutputResult ¶
func RoundtripMarshal ¶
func RoundtripMarshal(data interface{}) ([]interface{}, error)
RoundtripMarshal marshals and unmarshals the data so that properties match the JSON property names
Types ¶
type Formatter ¶
Formatter is a function that formats a cell value for a table. The first argument is the column index The second argument is the width of the column The third argument is the value to format
type OutputFormat ¶
type OutputFormat string
const ( OutputJson OutputFormat = "json" OutputJsonC OutputFormat = "jsonc" OutputTsv OutputFormat = "tsv" OutputTable OutputFormat = "table" OutputTableBody OutputFormat = "tablebody" )
type OutputLink ¶
func DecodeOutputLink ¶
func DecodeOutputLink(encodedValue string) *OutputLink
func (OutputLink) Encode ¶
func (ol OutputLink) Encode() string
Click to show internal directories.
Click to hide internal directories.