tiktbl

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Example
var tbl Data
tbl.Set(0, 0, "foo")
tbl.Set(0, 1, "bar")
tbl.Set(1, 0, "", Span(-1), Pad('-'))
tbl.Set(2, 0, "baz", Span(2), Center, Pad('.'))
(&Terminal{CellPad: " | "}).Write(os.Stdout, &tbl)
Output:

foo | bar
---------
...baz...

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Align

type Align int
const (
	Left Align = 1 + iota
	Center
	Right
)

type CSV

type CSV struct {
	FS             string
	SkipEmptyLines bool
}

func (*CSV) Write

func (tw *CSV) Write(w io.Writer, t *Data) error

type CellOpt

type CellOpt interface {
	// contains filtered or unexported methods
}

type Cursor

type Cursor struct {
	Error error
	// contains filtered or unexported fields
}

func (*Cursor) NextRow

func (c *Cursor) NextRow() *Cursor

func (*Cursor) Set

func (c *Cursor) Set(data any, opts ...CellOpt) *Cursor

func (*Cursor) SetString

func (c *Cursor) SetString(text string, opts ...CellOpt) *Cursor

func (*Cursor) SetStrings

func (c *Cursor) SetStrings(texts ...string) *Cursor

func (*Cursor) Sets

func (c *Cursor) Sets(data ...any) *Cursor

func (*Cursor) Skip

func (c *Cursor) Skip(i int) *Cursor

func (*Cursor) With

func (c *Cursor) With(opts ...CellOpt) with

type Data

type Data struct {
	// contains filtered or unexported fields
}

func (*Data) Align

func (t *Data) Align(a Align, cs ...int)

func (*Data) At

func (t *Data) At(r, c int) *Cursor

func (*Data) ColumnWidths

func (t *Data) ColumnWidths(pad string) (cws []int)

func (*Data) Columns

func (t *Data) Columns() int

func (*Data) Set

func (t *Data) Set(r, c int, data any, opts ...CellOpt) error

func (*Data) SetString

func (t *Data) SetString(r, c int, text string, opts ...CellOpt) error

type Pad

type Pad rune

type Span

type Span int
const SpanAll Span = -1

type Style

type Style func(string) string

type Styler

type Styler interface {
	CellOpt
	// contains filtered or unexported methods
}

func AddStyles

func AddStyles(s Styler, add ...Styler) Styler

func NoStyle

func NoStyle() Styler

type Styles

type Styles []Styler

type Terminal

type Terminal struct {
	CellPad string
}

func (*Terminal) Write

func (tw *Terminal) Write(w io.Writer, t *Data) error

type Writer

type Writer interface {
	Write(w io.Writer, t *Data) error
}

Jump to

Keyboard shortcuts

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