display

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UNICODEStyle   = table.StyleRounded
	ASCIIStyle     = table.StyleDefault
	DefaultTBStyle = ASCIIStyle
)
View Source
var Output io.Writer = os.Stdout

Functions

func DefaultTB added in v0.8.0

func DefaultTB(w table.Writer)

func RawPrint added in v0.8.0

func RawPrint(toPrint ...any) (n int, err error)

func WidthLen

func WidthLen(str string) int

Types

type Across

type Across struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func (Across) AddAfterPrint

func (h Across) AddAfterPrint(f ...func(Printer, ...Item))

func (Across) AddBeforePrint

func (h Across) AddBeforePrint(f ...func(Printer, ...Item))

func (Across) DisableHookAfter added in v0.8.0

func (h Across) DisableHookAfter()

func (Across) DisableHookBefore added in v0.8.0

func (h Across) DisableHookBefore()

func (Across) EnableHookAfter added in v0.8.0

func (h Across) EnableHookAfter()

func (Across) EnableHookBefore added in v0.8.0

func (h Across) EnableHookBefore()

func (*Across) Print

func (a *Across) Print(items ...Item)

type Byline

type Byline struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func (Byline) AddAfterPrint

func (h Byline) AddAfterPrint(f ...func(Printer, ...Item))

func (Byline) AddBeforePrint

func (h Byline) AddBeforePrint(f ...func(Printer, ...Item))

func (Byline) DisableHookAfter added in v0.8.0

func (h Byline) DisableHookAfter()

func (Byline) DisableHookBefore added in v0.8.0

func (h Byline) DisableHookBefore()

func (Byline) EnableHookAfter added in v0.8.0

func (h Byline) EnableHookAfter()

func (Byline) EnableHookBefore added in v0.8.0

func (h Byline) EnableHookBefore()

func (*Byline) Print

func (b *Byline) Print(i ...Item)

type CSVPrinter added in v0.8.0

type CSVPrinter struct {
	*TablePrinter
}

func (CSVPrinter) AddAfterPrint added in v0.8.0

func (h CSVPrinter) AddAfterPrint(f ...func(Printer, ...Item))

func (CSVPrinter) AddBeforePrint added in v0.8.0

func (h CSVPrinter) AddBeforePrint(f ...func(Printer, ...Item))

func (CSVPrinter) DisableHookAfter added in v0.8.0

func (h CSVPrinter) DisableHookAfter()

func (CSVPrinter) DisableHookBefore added in v0.8.0

func (h CSVPrinter) DisableHookBefore()

func (CSVPrinter) EnableHookAfter added in v0.8.0

func (h CSVPrinter) EnableHookAfter()

func (CSVPrinter) EnableHookBefore added in v0.8.0

func (h CSVPrinter) EnableHookBefore()

func (*CSVPrinter) Print added in v0.8.0

func (c *CSVPrinter) Print(s ...Item)

type CommaPrint

type CommaPrint struct {
	*Across
	// contains filtered or unexported fields
}

func (CommaPrint) AddAfterPrint

func (h CommaPrint) AddAfterPrint(f ...func(Printer, ...Item))

func (CommaPrint) AddBeforePrint

func (h CommaPrint) AddBeforePrint(f ...func(Printer, ...Item))

func (CommaPrint) DisableHookAfter added in v0.8.0

func (h CommaPrint) DisableHookAfter()

func (CommaPrint) DisableHookBefore added in v0.8.0

func (h CommaPrint) DisableHookBefore()

func (CommaPrint) EnableHookAfter added in v0.8.0

func (h CommaPrint) EnableHookAfter()

func (CommaPrint) EnableHookBefore added in v0.8.0

func (h CommaPrint) EnableHookBefore()

func (*CommaPrint) Print

func (c *CommaPrint) Print(items ...Item)

type Content

type Content interface {
	String() string
}

type FitTerminal

type FitTerminal struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func (FitTerminal) AddAfterPrint

func (h FitTerminal) AddAfterPrint(f ...func(Printer, ...Item))

func (FitTerminal) AddBeforePrint

func (h FitTerminal) AddBeforePrint(f ...func(Printer, ...Item))

func (FitTerminal) DisableHookAfter added in v0.8.0

func (h FitTerminal) DisableHookAfter()

func (FitTerminal) DisableHookBefore added in v0.8.0

func (h FitTerminal) DisableHookBefore()

func (FitTerminal) EnableHookAfter added in v0.8.0

func (h FitTerminal) EnableHookAfter()

func (FitTerminal) EnableHookBefore added in v0.8.0

func (h FitTerminal) EnableHookBefore()

func (*FitTerminal) Print

func (f *FitTerminal) Print(i ...Item)

type HTMLPrinter added in v0.8.0

type HTMLPrinter struct {
	*TablePrinter
}

func (HTMLPrinter) AddAfterPrint added in v0.8.0

func (h HTMLPrinter) AddAfterPrint(f ...func(Printer, ...Item))

func (HTMLPrinter) AddBeforePrint added in v0.8.0

func (h HTMLPrinter) AddBeforePrint(f ...func(Printer, ...Item))

func (HTMLPrinter) DisableHookAfter added in v0.8.0

func (h HTMLPrinter) DisableHookAfter()

func (HTMLPrinter) DisableHookBefore added in v0.8.0

func (h HTMLPrinter) DisableHookBefore()

func (HTMLPrinter) EnableHookAfter added in v0.8.0

func (h HTMLPrinter) EnableHookAfter()

func (HTMLPrinter) EnableHookBefore added in v0.8.0

func (h HTMLPrinter) EnableHookBefore()

func (*HTMLPrinter) Print added in v0.8.0

func (p *HTMLPrinter) Print(s ...Item)

type Hook

type Hook interface {
	AddBeforePrint(...func(Printer, ...Item))
	AddAfterPrint(...func(Printer, ...Item))
	DisableHookBefore()
	EnableHookBefore()
	DisableHookAfter()
	EnableHookAfter()
}

type Item

type Item struct {
	Delimiter string
	// contains filtered or unexported fields
}

func NewItem

func NewItem(Ops ...ItemOptions) *Item

func (*Item) Del

func (i *Item) Del(key string)

func (*Item) ExcludeOrderedContent

func (i *Item) ExcludeOrderedContent(key ...string) string

ExcludeOrderedContent get content in order, exclude those match given parameter(ordered by itemContent.No, ascending)

func (*Item) Get

func (i *Item) Get(key string) (ItemContent, bool)

Get content by key

func (*Item) GetAll added in v0.8.0

func (i *Item) GetAll() map[string]ItemContent

func (*Item) GetAllOrdered added in v0.8.0

func (i *Item) GetAllOrdered() []ItemContent

func (*Item) IncludeOrderedContent

func (i *Item) IncludeOrderedContent(names ...string) string

IncludeOrderedContent return those content inorder(ordered by itemContent.No, ascending)

func (*Item) Keys

func (i *Item) Keys() []string

Keys return all keys in random order

func (*Item) KeysByOrder

func (i *Item) KeysByOrder() []string

KeysByOrder return Keys(ordered by itemContent.No, ascending)

func (*Item) OrderedContent

func (i *Item) OrderedContent() string

OrderedContent return all content in order(ordered by itemContent.No, ascending)

func (*Item) Set

func (i *Item) Set(key string, ic ItemContent)

Set content by key

type ItemContent

type ItemContent struct {
	No      int
	Content Content
}

type ItemOptions

type ItemOptions func(*Item)

func WithDelimiter

func WithDelimiter(d string) ItemOptions

type JsonPrinter added in v0.8.0

type JsonPrinter struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func (JsonPrinter) AddAfterPrint added in v0.8.0

func (h JsonPrinter) AddAfterPrint(f ...func(Printer, ...Item))

func (JsonPrinter) AddBeforePrint added in v0.8.0

func (h JsonPrinter) AddBeforePrint(f ...func(Printer, ...Item))

func (JsonPrinter) DisableHookAfter added in v0.8.0

func (h JsonPrinter) DisableHookAfter()

func (JsonPrinter) DisableHookBefore added in v0.8.0

func (h JsonPrinter) DisableHookBefore()

func (JsonPrinter) EnableHookAfter added in v0.8.0

func (h JsonPrinter) EnableHookAfter()

func (JsonPrinter) EnableHookBefore added in v0.8.0

func (h JsonPrinter) EnableHookBefore()

func (*JsonPrinter) Print added in v0.8.0

func (j *JsonPrinter) Print(items ...Item)

type MDPrinter added in v0.8.0

type MDPrinter struct {
	*TablePrinter
}

func (MDPrinter) AddAfterPrint added in v0.8.0

func (h MDPrinter) AddAfterPrint(f ...func(Printer, ...Item))

func (MDPrinter) AddBeforePrint added in v0.8.0

func (h MDPrinter) AddBeforePrint(f ...func(Printer, ...Item))

func (MDPrinter) DisableHookAfter added in v0.8.0

func (h MDPrinter) DisableHookAfter()

func (MDPrinter) DisableHookBefore added in v0.8.0

func (h MDPrinter) DisableHookBefore()

func (MDPrinter) EnableHookAfter added in v0.8.0

func (h MDPrinter) EnableHookAfter()

func (MDPrinter) EnableHookBefore added in v0.8.0

func (h MDPrinter) EnableHookBefore()

func (*MDPrinter) Print added in v0.8.0

func (m *MDPrinter) Print(s ...Item)

type PrettyPrinter added in v0.8.0

type PrettyPrinter interface {
	SetTitle(title string)
	AddHeader(headers string)
	AddFooter(footer string)
	Printer
}

type Printer

type Printer interface {
	Print(s ...Item)
	Hook
	io.Writer
}

func NewAcross

func NewAcross() Printer

func NewByline

func NewByline() Printer

func NewCSVPrinter added in v0.8.0

func NewCSVPrinter() Printer

func NewCommaPrint

func NewCommaPrint() Printer

func NewFitTerminal

func NewFitTerminal() Printer

func NewHTMLPrinter added in v0.8.0

func NewHTMLPrinter() Printer

func NewJsonPrinter added in v0.8.0

func NewJsonPrinter() Printer

func NewMDPrinter added in v0.8.0

func NewMDPrinter() Printer

func NewTablePrinter added in v0.8.0

func NewTablePrinter(opts ...func(writer table.Writer)) Printer

func NewZero

func NewZero() Printer

type StringContent

type StringContent string

func (StringContent) String

func (s StringContent) String() string

type TablePrinter added in v0.8.0

type TablePrinter struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func (TablePrinter) AddAfterPrint added in v0.8.0

func (h TablePrinter) AddAfterPrint(f ...func(Printer, ...Item))

func (TablePrinter) AddBeforePrint added in v0.8.0

func (h TablePrinter) AddBeforePrint(f ...func(Printer, ...Item))

func (*TablePrinter) AddFooter added in v0.8.0

func (t *TablePrinter) AddFooter(footer string)

func (*TablePrinter) AddHeader added in v0.8.0

func (t *TablePrinter) AddHeader(headers string)

func (TablePrinter) DisableHookAfter added in v0.8.0

func (h TablePrinter) DisableHookAfter()

func (TablePrinter) DisableHookBefore added in v0.8.0

func (h TablePrinter) DisableHookBefore()

func (TablePrinter) EnableHookAfter added in v0.8.0

func (h TablePrinter) EnableHookAfter()

func (TablePrinter) EnableHookBefore added in v0.8.0

func (h TablePrinter) EnableHookBefore()

func (*TablePrinter) Print added in v0.8.0

func (t *TablePrinter) Print(s ...Item)

func (*TablePrinter) PrintBase added in v0.8.0

func (t *TablePrinter) PrintBase(fn func() string, s ...Item)

func (*TablePrinter) SetTitle added in v0.8.0

func (t *TablePrinter) SetTitle(title string)

type Zero

type Zero struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func (Zero) AddAfterPrint

func (h Zero) AddAfterPrint(f ...func(Printer, ...Item))

func (Zero) AddBeforePrint

func (h Zero) AddBeforePrint(f ...func(Printer, ...Item))

func (Zero) DisableHookAfter added in v0.8.0

func (h Zero) DisableHookAfter()

func (Zero) DisableHookBefore added in v0.8.0

func (h Zero) DisableHookBefore()

func (Zero) EnableHookAfter added in v0.8.0

func (h Zero) EnableHookAfter()

func (Zero) EnableHookBefore added in v0.8.0

func (h Zero) EnableHookBefore()

func (*Zero) Print

func (z *Zero) Print(items ...Item)

Jump to

Keyboard shortcuts

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