Documentation
¶
Overview ¶
*
- Copyright 2021 Napptive *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- https://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Index ¶
Constants ¶
const ( // MinWidth is the minimal cell width including any padding. MinWidth = 8 // TabWidth is the width of tab characters (equivalent number of spaces) TabWidth = 4 // Padding added to a cell before computing its width Padding = 4 // PaddingChar with the ASCII char used for padding PaddingChar = ' ' // TabWriterFlags with the formatting options. TabWriterFlags = 0 )
const ApplicationListTemplate = `APPLICATION NAME
{{range $other, $app := .Applications}}{{fromApplicationSummary $app}}{{end}}`
const InfoAppResponseTemplate = `` /* 477-byte string literal not displayed */
InfoAppResponseTemplate with the table representation of an InfoAppResponse.
const OpResponseTemplate = `STATUS INFO
{{.StatusName}} {{.UserInfo}}
`
OpResponseTemplate with the table representation of an OpResponse.
const SummaryResponseTemplate = `NAMESPACES APPLICATIONS TAGS
{{.NumNamespaces}} {{.NumApplications}} {{.NumTags}}
`
Variables ¶
This section is empty.
Functions ¶
func GetTemplate ¶
GetTemplate returns a template to print an arbitrary structure in table format.
Types ¶
type JSONPrinter ¶
type JSONPrinter struct { }
JSONPrinter structure with the implementation required to print as JSON a given result.
func (*JSONPrinter) Print ¶
func (jp *JSONPrinter) Print(result interface{}) error
Print the result.
type NoPrinter ¶
type NoPrinter struct { }
NoPrinter structure with the implementation required to print an empty result. Sometimes we could not to print the result
type ResultPrinter ¶
type ResultPrinter interface { // Print the result. Print(result interface{}) error }
ResultPrinter defines the operations that a printer must define. Multiple printer are offered depending on the desired output format.
func GetPrinter ¶
func GetPrinter(printerType string) (ResultPrinter, error)
GetPrinter creates a ResultPrinter attending to the user preferences.
func NewJSONPrinter ¶
func NewJSONPrinter() (ResultPrinter, error)
NewJSONPrinter build a new ResultPrinter whose output is the JSON representation of the object.
func NewTablePrinter ¶
func NewTablePrinter() (ResultPrinter, error)
NewTablePrinter builds a new ResultPrinter whose output is a human readable table-like representation of the object.
type TablePrinter ¶
type TablePrinter struct { }
TablePrinter structure with the implementation required to print in a human readable table format a given result.
func (*TablePrinter) Print ¶
func (tp *TablePrinter) Print(result interface{}) error
Print the result.