Documentation ¶
Index ¶
- Constants
- func Clean()
- func Flush() error
- func GetErrorLines() []interface{}
- func GetLines() []interface{}
- func OverrideEnablePager(enable bool)
- func Print(v interface{})
- func PrintError(msg string)
- func PrintT(templateString string, v interface{})
- func PrintWarning(msg string)
- func SetCommand(cmd *cobra.Command)
- func SetFormat(t string)
- func SetQuiet(q bool)
- func SetServerAddres(addr string)
- func SetSingle(single bool)
- type Key
- type Printer
Constants ¶
const ( ArrowLeft = rune(KeyCtrlB) ArrowRight = rune(KeyCtrlF) ArrowUp = rune(KeyCtrlP) ArrowDown = rune(KeyCtrlN) Space = ' ' Enter = '\r' NewLine = '\n' Backspace = rune(KeyCtrlH) Backspace2 = rune(KeyDEL) )
These are the key that aliases
const ( FormatPlain = "plain" FormatJSON = "json" )
Variables ¶
This section is empty.
Functions ¶
func GetErrorLines ¶
func GetErrorLines() []interface{}
GetErrorLines returns the printer's accumulated error lines
func OverrideEnablePager ¶
func OverrideEnablePager(enable bool)
func Print ¶
func Print(v interface{})
Print an element. If the format requires a template, the element will be printed as a structure with field names using the print verb %+v
func PrintT ¶
func PrintT(templateString string, v interface{})
PrintT prints an element. Depending on the format, the element can be formatted and printed as a structure or used to populate the template
func PrintWarning ¶
func PrintWarning(msg string)
PrintWarning prints warning message to the error output, unlike Print and PrintError functions, PrintWarning writes the output immediately instead of waiting command to finish.
func SetCommand ¶
func SetFormat ¶
func SetFormat(t string)
SetFormat sets the format for the final output of the printer
func SetServerAddres ¶
func SetServerAddres(addr string)
Types ¶
type Key ¶
type Key int16
Key is the ascii codes of a keys
const ( KeyCtrlSpace Key = iota KeyCtrlA // KeySOH KeyCtrlB // KeySTX KeyCtrlC // KeyETX KeyCtrlD // KeyEOT KeyCtrlE // KeyENQ KeyCtrlF // KeyACK KeyCtrlG // KeyBEL KeyCtrlH // KeyBS KeyCtrlI // KeyTAB KeyCtrlJ // KeyLF KeyCtrlK // KeyVT KeyCtrlL // KeyFF KeyCtrlM // KeyCR KeyCtrlN // KeySO KeyCtrlO // KeySI KeyCtrlP // KeyDLE KeyCtrlQ // KeyDC1 KeyCtrlR // KeyDC2 KeyCtrlS // KeyDC3 KeyCtrlT // KeyDC4 KeyCtrlU // KeyNAK KeyCtrlV // KeySYN KeyCtrlW // KeyETB KeyCtrlX // KeyCAN KeyCtrlY // KeyEM KeyCtrlZ // KeySUB KeyESC // KeyESC KeyCtrlBackslash // KeyFS KeyCtrlRightSq // KeyGS KeyCtrlCarat // KeyRS KeyCtrlUnderscore // KeyUS KeyDEL = 0x7F )
These are the control keys. Note that they overlap with other keys.