Documentation ¶
Overview ¶
Package display This package controls the display format, like grid/across/byline/...
Index ¶
- Constants
- Variables
- func DefaultTB(w table.Writer)
- func RawPrint(toPrint ...any) (n int, err error)
- func WidthLen(str string) int
- func WidthNoHyperLinkLen(str string) int
- type Across
- func (h Across) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h Across) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h Across) DisablePostHook()
- func (h Across) DisablePreHook()
- func (h Across) EnablePostHook()
- func (h Across) EnablePreHook()
- func (a *Across) Print(items ...*item.FileInfo)
- type Byline
- func (h Byline) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h Byline) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h Byline) DisablePostHook()
- func (h Byline) DisablePreHook()
- func (h Byline) EnablePostHook()
- func (h Byline) EnablePreHook()
- func (b *Byline) Print(i ...*item.FileInfo)
- type CSVPrinter
- func (h CSVPrinter) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h CSVPrinter) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h CSVPrinter) DisablePostHook()
- func (h CSVPrinter) DisablePreHook()
- func (h CSVPrinter) EnablePostHook()
- func (h CSVPrinter) EnablePreHook()
- func (c *CSVPrinter) Print(s ...*item.FileInfo)
- type CommaPrint
- func (h CommaPrint) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h CommaPrint) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h CommaPrint) DisablePostHook()
- func (h CommaPrint) DisablePreHook()
- func (h CommaPrint) EnablePostHook()
- func (h CommaPrint) EnablePreHook()
- func (c *CommaPrint) Print(items ...*item.FileInfo)
- type Content
- type FitTerminal
- func (h FitTerminal) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h FitTerminal) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h FitTerminal) DisablePostHook()
- func (h FitTerminal) DisablePreHook()
- func (h FitTerminal) EnablePostHook()
- func (h FitTerminal) EnablePreHook()
- func (f *FitTerminal) Print(i ...*item.FileInfo)
- type HeaderMaker
- type Hook
- type ItemContent
- type JsonPrinter
- func (h JsonPrinter) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h JsonPrinter) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h JsonPrinter) DisablePostHook()
- func (h JsonPrinter) DisablePreHook()
- func (h JsonPrinter) EnablePostHook()
- func (h JsonPrinter) EnablePreHook()
- func (j *JsonPrinter) Print(items ...*item.FileInfo)
- type MDPrinter
- func (h MDPrinter) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h MDPrinter) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h MDPrinter) DisablePostHook()
- func (h MDPrinter) DisablePreHook()
- func (h MDPrinter) EnablePostHook()
- func (h MDPrinter) EnablePreHook()
- func (m *MDPrinter) Print(s ...*item.FileInfo)
- type PrettyPrinter
- type Printer
- func NewAcross() Printer
- func NewByline() Printer
- func NewCSVPrinter() Printer
- func NewCommaPrint() Printer
- func NewFitTerminal() Printer
- func NewJsonPrinter() Printer
- func NewMDPrinter() Printer
- func NewTSVPrinter() Printer
- func NewTablePrinter(opts ...func(writer table.Writer)) Printer
- func NewZero() Printer
- type StringContent
- type TSVPrinter
- func (h TSVPrinter) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h TSVPrinter) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h TSVPrinter) DisablePostHook()
- func (h TSVPrinter) DisablePreHook()
- func (h TSVPrinter) EnablePostHook()
- func (h TSVPrinter) EnablePreHook()
- func (t *TSVPrinter) Print(s ...*item.FileInfo)
- type TablePrinter
- func (h TablePrinter) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h TablePrinter) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (t *TablePrinter) AddFooter(footer string)
- func (t *TablePrinter) AddHeader(headers string)
- func (h TablePrinter) DisablePostHook()
- func (h TablePrinter) DisablePreHook()
- func (h TablePrinter) EnablePostHook()
- func (h TablePrinter) EnablePreHook()
- func (t *TablePrinter) Print(s ...*item.FileInfo)
- func (t *TablePrinter) PrintBase(fn func() string, s ...*item.FileInfo)
- func (t *TablePrinter) SetTitle(title string)
- type TreePrinter
- func (h TreePrinter) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h TreePrinter) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h TreePrinter) DisablePostHook()
- func (h TreePrinter) DisablePreHook()
- func (h TreePrinter) EnablePostHook()
- func (h TreePrinter) EnablePreHook()
- func (t *TreePrinter) Print(s ...*item.FileInfo)
- type Zero
- func (h Zero) AddAfterPrint(f ...func(Printer, ...*item.FileInfo))
- func (h Zero) AddBeforePrint(f ...func(Printer, ...*item.FileInfo))
- func (h Zero) DisablePostHook()
- func (h Zero) DisablePreHook()
- func (h Zero) EnablePostHook()
- func (h Zero) EnablePreHook()
- func (z *Zero) Print(items ...*item.FileInfo)
Constants ¶
View Source
const ( TreeUnicode TreeASCII TreeRectangle )
Variables ¶
View Source
var ( UNICODEStyle = table.StyleRounded ASCIIStyle = table.StyleDefault DefaultTBStyle = ASCIIStyle DefaultTreeStyle = TreeUnicode )
View Source
var (
CustomTermSize uint
)
View Source
var IncludeHyperlink = false
View Source
var Output io.Writer = os.Stdout
Functions ¶
func RawPrint ¶
RawPrint used for print statistics like:
underwent 898 microseconds statistic: 15 file(s), 5 dir(s), 0 link(s)
func WidthNoHyperLinkLen ¶
Types ¶
type Across ¶
func (Across) AddAfterPrint ¶
func (Across) AddBeforePrint ¶
func (Across) DisablePostHook ¶
func (h Across) DisablePostHook()
func (Across) DisablePreHook ¶
func (h Across) DisablePreHook()
func (Across) EnablePostHook ¶
func (h Across) EnablePostHook()
func (Across) EnablePreHook ¶
func (h Across) EnablePreHook()
type Byline ¶
func (Byline) AddAfterPrint ¶
func (Byline) AddBeforePrint ¶
func (Byline) DisablePostHook ¶
func (h Byline) DisablePostHook()
func (Byline) DisablePreHook ¶
func (h Byline) DisablePreHook()
func (Byline) EnablePostHook ¶
func (h Byline) EnablePostHook()
func (Byline) EnablePreHook ¶
func (h Byline) EnablePreHook()
type CSVPrinter ¶
type CSVPrinter struct {
*TablePrinter
}
func (CSVPrinter) AddAfterPrint ¶
func (CSVPrinter) AddBeforePrint ¶
func (CSVPrinter) DisablePostHook ¶
func (h CSVPrinter) DisablePostHook()
func (CSVPrinter) DisablePreHook ¶
func (h CSVPrinter) DisablePreHook()
func (CSVPrinter) EnablePostHook ¶
func (h CSVPrinter) EnablePostHook()
func (CSVPrinter) EnablePreHook ¶
func (h CSVPrinter) EnablePreHook()
func (*CSVPrinter) Print ¶
func (c *CSVPrinter) Print(s ...*item.FileInfo)
type CommaPrint ¶
type CommaPrint struct { *Across // contains filtered or unexported fields }
func (CommaPrint) AddAfterPrint ¶
func (CommaPrint) AddBeforePrint ¶
func (CommaPrint) DisablePostHook ¶
func (h CommaPrint) DisablePostHook()
func (CommaPrint) DisablePreHook ¶
func (h CommaPrint) DisablePreHook()
func (CommaPrint) EnablePostHook ¶
func (h CommaPrint) EnablePostHook()
func (CommaPrint) EnablePreHook ¶
func (h CommaPrint) EnablePreHook()
func (*CommaPrint) Print ¶
func (c *CommaPrint) Print(items ...*item.FileInfo)
type FitTerminal ¶
func (FitTerminal) AddAfterPrint ¶
func (FitTerminal) AddBeforePrint ¶
func (FitTerminal) DisablePostHook ¶
func (h FitTerminal) DisablePostHook()
func (FitTerminal) DisablePreHook ¶
func (h FitTerminal) DisablePreHook()
func (FitTerminal) EnablePostHook ¶
func (h FitTerminal) EnablePostHook()
func (FitTerminal) EnablePreHook ¶
func (h FitTerminal) EnablePreHook()
func (*FitTerminal) Print ¶
func (f *FitTerminal) Print(i ...*item.FileInfo)
type HeaderMaker ¶ added in v0.27.0
type Hook ¶
type Hook interface { AddBeforePrint(...func(Printer, ...*item.FileInfo)) AddAfterPrint(...func(Printer, ...*item.FileInfo)) DisablePreHook() EnablePreHook() DisablePostHook() EnablePostHook() }
Hook is used to add pre-content and post-content like adding a header or footer:
Permissions Size Owner Group Time Modified Name
type ItemContent ¶
func (*ItemContent) AddPrefix ¶
func (i *ItemContent) AddPrefix(add string)
func (*ItemContent) AddSuffix ¶
func (i *ItemContent) AddSuffix(add string)
func (*ItemContent) NO ¶
func (i *ItemContent) NO() int
func (*ItemContent) SetPrefix ¶
func (i *ItemContent) SetPrefix(s string)
func (*ItemContent) SetSuffix ¶
func (i *ItemContent) SetSuffix(s string)
func (*ItemContent) String ¶
func (i *ItemContent) String() string
type JsonPrinter ¶
type JsonPrinter struct { *bufio.Writer Extra []any // RawPrint can't output in json, so we need an extra field // contains filtered or unexported fields }
func (JsonPrinter) AddAfterPrint ¶
func (JsonPrinter) AddBeforePrint ¶
func (JsonPrinter) DisablePostHook ¶
func (h JsonPrinter) DisablePostHook()
func (JsonPrinter) DisablePreHook ¶
func (h JsonPrinter) DisablePreHook()
func (JsonPrinter) EnablePostHook ¶
func (h JsonPrinter) EnablePostHook()
func (JsonPrinter) EnablePreHook ¶
func (h JsonPrinter) EnablePreHook()
func (*JsonPrinter) Print ¶
func (j *JsonPrinter) Print(items ...*item.FileInfo)
type MDPrinter ¶
type MDPrinter struct {
*TablePrinter
}
func (MDPrinter) AddAfterPrint ¶
func (MDPrinter) AddBeforePrint ¶
func (MDPrinter) DisablePostHook ¶
func (h MDPrinter) DisablePostHook()
func (MDPrinter) DisablePreHook ¶
func (h MDPrinter) DisablePreHook()
func (MDPrinter) EnablePostHook ¶
func (h MDPrinter) EnablePostHook()
func (MDPrinter) EnablePreHook ¶
func (h MDPrinter) EnablePreHook()
type PrettyPrinter ¶
type Printer ¶
Printer is the interface of all printers. all printers should implement this interface
func NewCSVPrinter ¶
func NewCSVPrinter() Printer
func NewCommaPrint ¶
func NewCommaPrint() Printer
func NewFitTerminal ¶
func NewFitTerminal() Printer
func NewJsonPrinter ¶
func NewJsonPrinter() Printer
func NewMDPrinter ¶
func NewMDPrinter() Printer
func NewTSVPrinter ¶
func NewTSVPrinter() Printer
func NewTablePrinter ¶
type StringContent ¶
type StringContent string
func (StringContent) String ¶
func (s StringContent) String() string
type TSVPrinter ¶
type TSVPrinter struct {
*TablePrinter
}
func (TSVPrinter) AddAfterPrint ¶
func (TSVPrinter) AddBeforePrint ¶
func (TSVPrinter) DisablePostHook ¶
func (h TSVPrinter) DisablePostHook()
func (TSVPrinter) DisablePreHook ¶
func (h TSVPrinter) DisablePreHook()
func (TSVPrinter) EnablePostHook ¶
func (h TSVPrinter) EnablePostHook()
func (TSVPrinter) EnablePreHook ¶
func (h TSVPrinter) EnablePreHook()
func (*TSVPrinter) Print ¶
func (t *TSVPrinter) Print(s ...*item.FileInfo)
type TablePrinter ¶
func (TablePrinter) AddAfterPrint ¶
func (TablePrinter) AddBeforePrint ¶
func (*TablePrinter) AddFooter ¶
func (t *TablePrinter) AddFooter(footer string)
func (*TablePrinter) AddHeader ¶
func (t *TablePrinter) AddHeader(headers string)
func (TablePrinter) DisablePostHook ¶
func (h TablePrinter) DisablePostHook()
func (TablePrinter) DisablePreHook ¶
func (h TablePrinter) DisablePreHook()
func (TablePrinter) EnablePostHook ¶
func (h TablePrinter) EnablePostHook()
func (TablePrinter) EnablePreHook ¶
func (h TablePrinter) EnablePreHook()
func (*TablePrinter) Print ¶
func (t *TablePrinter) Print(s ...*item.FileInfo)
func (*TablePrinter) PrintBase ¶
func (t *TablePrinter) PrintBase(fn func() string, s ...*item.FileInfo)
func (*TablePrinter) SetTitle ¶
func (t *TablePrinter) SetTitle(title string)
type TreePrinter ¶
func NewTreePrinter ¶
func NewTreePrinter() *TreePrinter
func (TreePrinter) AddAfterPrint ¶
func (TreePrinter) AddBeforePrint ¶
func (TreePrinter) DisablePostHook ¶
func (h TreePrinter) DisablePostHook()
func (TreePrinter) DisablePreHook ¶
func (h TreePrinter) DisablePreHook()
func (TreePrinter) EnablePostHook ¶
func (h TreePrinter) EnablePostHook()
func (TreePrinter) EnablePreHook ¶
func (h TreePrinter) EnablePreHook()
func (*TreePrinter) Print ¶
func (t *TreePrinter) Print(s ...*item.FileInfo)
type Zero ¶
func (Zero) AddAfterPrint ¶
func (Zero) AddBeforePrint ¶
func (Zero) DisablePostHook ¶
func (h Zero) DisablePostHook()
func (Zero) DisablePreHook ¶
func (h Zero) DisablePreHook()
func (Zero) EnablePostHook ¶
func (h Zero) EnablePostHook()
func (Zero) EnablePreHook ¶
func (h Zero) EnablePreHook()
Click to show internal directories.
Click to hide internal directories.