ctxout

package module
v0.0.0-...-3dbd443 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 18 Imported by: 4

README

Contxt Output Handle

NOTE: execution is delayed by an timer. see the code in example folder

example

this library maps different ways to render output.

  • post filter
  • injected PrinterInterface
  • stream handler

usecase is to have an output handler, which can be used in different ways depending on the capabilities of the output device. and this whithout to have to taking care of the output device.

the base idea is to have one way to render output, and extend them with different handlers, they are responsible for the output by itself. so if i like to have an colored output, i just add an printer, which is responsible for the coloring. so i expect i can add any color code to the output, and the printer will handle it even if the output device is not able to handle it.

for that being possible, any code, like defining a color, is done by an markup, that comes from the output handler.

so instead of writing

fmt.Printf("\033[1;33m%s\033[0m", "hello world")

i can write

ctxout.PrintLn(ctxout.NewMOWrap(),ctxout.BoldTag, ctxout.ForeYellow, "hello world", ctxout.ResetCode)

the printer will handle the markup and the output device will get the colored output. and if the output device is not able to handle the markup, the printer will handle it and ignore the colorcodes.

the responsible outputhandler needs to be added to the output chain, before the markup is used. (ctxout.PrintLn(ctxout.NewMOWrap(),...) )

basic usage

simple output
ctxout.Print("hello world")
output with post filter (table for example)

a Post filter is an output handler, which is called after the output is rendered. once added, it will be called on every output, until it is removed.

ctxout.AddPostFilter(ctxout.NewTabOut())
ctxout.PrintLn(
	ctxout.Table(
		ctxout.Row(
			ctxout.TD("hello", "size=50", "origin=2"),
			ctxout.TD("world", "size=50", "origin=1"),
		),
	),
)

output with injected printer (colored for example)

a printer is an output handler, which is called before the output is rendered. but instead of a post filter, it is only called once.

so it must be added before the output is rendered and will not be called again on the next print command.

ctxout.PrintLn(
    ctxout.NewMOWrap(), 
    ctxout.BoldTag, 
    ctxout.ForeYellow, 
    "hello world", 
    ctxout.ResetCode,
)
examples

if you checkout the sources, just run

go run ./module/ctxout/examples/base.go

this example is made like an little on screen demo app, to show how the output handler behaves. so the delay is done by an timer and it is not a performance issue.

Documentation

Index

Constants

View Source
const (
	BaseSignInfo    = "<sign info>"
	BaseSignWarning = "<sign warning>"
	BaseSignError   = "<sign error>"
	BaseSignSuccess = "<sign success>"
	BaseSignDebug   = "<sign debug>"
	BaseSignScreen  = "<sign screen>"
)
View Source
const (
	OpenTable        = "<table>"
	TO               = "<table>"
	CloseTable       = "</table>"
	TC               = "</table>"
	OpenRow          = "<row>"
	RO               = "<row>"
	CloseRow         = "</row>"
	CR               = "</row>"
	OpenTab          = "<tab>"
	OTB              = "<tab>"
	CloseTab         = "</tab>"
	CTB              = "</tab>"
	CloseTabRow      = "</tab></row>"
	CTR              = "</tab></row>"
	CloseTabRowTable = "</tab></row></table>"
	CTRT             = "</tab></row></table>"
	OpenTableRow     = "<table><row>"
	OTR              = "<table><row>"
	CloseRowTable    = "</row></table>"
	CRT              = "</row></table>"
)

just shortcuts for table tags

View Source
const (
	TableStart = "<table"
	TableEnd   = "</table>"
	RowStart   = "<row>"
	RowEnd     = "</row>"
	TabStart   = "<tab"
	TabEnd     = "</tab>"
	// defines the size of the cell in relation to the max length of the screen. 10 means 10% of the screen
	AttrSize = "size"
	// defines the char if the cell should fill the remaining space of the cell
	// default is  " " (space)
	ATTR_FILL = "fill"
	// defines how the cell should be aligned
	// 1 = left, 2 = right
	AttrOrigin = "origin"
	// defines how the space is calculated.
	// fixed = if the calculated size is bigger than the cell size, then we will use the cell size
	// extend = fill the rest of the row with the space if prevoius fixed or content cells are smaller than the calculated size
	// content = we will use the max size of the content if they is smaller than the calculated size
	AttrDraw    = "draw"
	DrawFixed   = "fixed"
	DrawExtend  = "extend"
	DrawContent = "content"

	// if the text is cutted, then this string will be added to the end of the text
	AttrCutAdd = "cut-add"
	// this is the mode how the overflow is handled. ignore = the text is ignored, wrap = wrap the text
	AttrOverflow = "overflow"
	// this is the suffix for the cell that will be added to the content all the time. is ment for colorcodes. here and clear code is usually used
	AttrSuffix = "suffix"
	// this is the prefix for the cell that will be placed in front of the content all the time. is ment for colorcodes
	AttrPrefix = "prefix"
	// additonal margin for the cell. this will be subtracted from the cell size
	AttrMargin = "margin"

	// overflow constants
	OfIgnore   = "ignore"
	OfWrap     = "wrap"
	OfWordWrap = "wordwrap"
	OfAny      = "any"

	// origin constants
	OriginLeft  = 0
	OriginRight = 2
)
View Source
const (
	// terminal reset code
	ResetCode = "\033[0m"
	// CleanTag is the tag to reset to default
	CleanTag = "</>"
	// ForeBlack black foreground color
	ForeBlack = "<f:black>"
	// ForeRed red foreground color
	ForeRed = "<f:red>"
	// ForeGreen red foreground color
	ForeGreen = "<f:green>"
	// ForeYellow red foreground color
	ForeYellow = "<f:yellow>"
	// ForeBlue red foreground color
	ForeBlue = "<f:blue>"
	// ForeMagenta red foreground color
	ForeMagenta = "<f:magenta>"
	// ForeCyan red foreground color
	ForeCyan = "<f:cyan>"
	// ForeLightGrey red foreground color
	ForeLightGrey = "<f:light-grey>"
	// ForeDarkGrey red foreground color
	ForeDarkGrey = "<f:dark-grey>"
	// ForeLightRed red foreground color
	ForeLightRed = "<f:light-red>"
	// ForeLightGreen red foreground color
	ForeLightGreen = "<f:light-green>"
	// ForeLightYellow red foreground color
	ForeLightYellow = "<f:light-yellow>"
	// ForeLightBlue red foreground color
	ForeLightBlue = "<f:light-blue>"
	// ForeLightCyan red foreground color
	ForeLightCyan = "<f:light-cyan>"
	// ForeLightMagenta red foreground color
	ForeLightMagenta = "<f:light-magenta>"
	// ForeWhite red foreground color
	ForeWhite = "<f:white>"

	// BoldTag writes bolder text
	BoldTag = "<b>"
	// Dim dim
	Dim = "<dim>"
	// Underlined tag
	Underlined = "<u>"
	// Reverse tag
	Reverse = "<r>"
	// Hidden tag
	Hidden = "<hide>"
	// ResetBold tag
	ResetBold = "</b>"
	// ResetDim tag
	ResetDim = "</dim>"
	// ResetUnderline tag
	ResetUnderline = "</u>"
	//ResetReverse tag
	ResetReverse = "</r>"
	//ResetHidden tag
	ResetHidden = "</hide>"

	// BackBlack black Background color
	BackBlack = "<b:black>"
	// BackRed red Background color
	BackRed = "<b:red>"
	// BackGreen red Background color
	BackGreen = "<b:green>"
	// BackYellow red Background color
	BackYellow = "<b:yellow>"
	// BackBlue red Background color
	BackBlue = "<b:blue>"
	// BackMagenta red Background color
	BackMagenta = "<b:magenta>"
	// BackCyan red Background color
	BackCyan = "<b:cyan>"
	// BackLightGrey red Background color
	BackLightGrey = "<b:light-grey>"
	// BackDarkGrey red Background color
	BackDarkGrey = "<b:dark-grey>"
	// BackLightRed red Background color
	BackLightRed = "<b:light-red>"
	// BackLightGreen red Background color
	BackLightGreen = "<b:light-green>"
	// BackLightYellow red Background color
	BackLightYellow = "<b:light-yellow>"
	// BackLightBlue red Background color
	BackLightBlue = "<b:light-blue>"
	// BackLightCyan red Background color
	BackLightCyan = "<b:light-cyan>"
	// BackLightMagenta red Background color
	BackLightMagenta = "<b:light-magenta>"
	// BackWhite red Background color
	BackWhite = "<b:white>"
)

Variables

View Source
var (
	// NotFoundSign is the sign that is returned if the sign is not found
	NotFoundSign = Sign{
		Name:     "notfound",
		Glyph:    "?",
		Fallback: "[?]",
	}
)
View Source
var (
	// PreHook is a function that can be used to intercept the message before it is printed
	// it is a very simple way to hook in the whole output process.
	// the return value is a bool. if false is returned the message will not be longer processed.
	// if true is returned the message will be processed further.
	// use this function with care. it is ment for testing or debugging.
	// an simple example is:
	//
	//    messages := []string{}
	//    ctxout.PreHook = func(msg ...interface{}) bool {
	//      messages = append(messages, ctxout.ToString(msg...))
	//      return true
	//    }
	//  ctxout.Print("hello world")
	//
	//  now you can inspect the messages slice
	PreHook func(msg ...interface{}) bool = nil
)

Functions

func AddPostFilter

func AddPostFilter(filter PostFilter)

AddPostFilter adds a post filter to the list of post filters these filters are called after the markup filter they works only on strings

func ClearPostFilters

func ClearPostFilters()

ClearPostFilters clears the list of post filters

func Content

func Content() string

func CtxOut

func CtxOut(msg ...interface{})

CtxOut is a shortcut for PrintLn

func CutNotifier

func CutNotifier(notifier string) string

func Extend

func Extend() string

func Fill

func Fill(with string) string

func FilterId

func FilterId() string

func FitWordsToMaxLen

func FitWordsToMaxLen(line string, max int) string

FitWordsToMaxLen fits the words of a string to the given max length and add a new line if the word would exceed the max length and then proceed with the next line until the string is done if the string contains words, they are longer than the max length then the words will not be cutted. they will be placed on a new line. result := ctxout.FitWordsToMaxLen("ab 1234567890 cdef", 5) result will be "ab\n1234567890\ncdef"

func Fixed

func Fixed() string

func ForceFilterUpdate

func ForceFilterUpdate(info PostFilterInfo)

Updates all registered post filters with the new terminal information

func GetLastEscapeSequence

func GetLastEscapeSequence(text string) string

func GetRunInfos

func GetRunInfos() []string

GetRunInfos returns the list of run infos while the message is processed, we add infos to this list

func GetRunInfosF

func GetRunInfosF(pattern string) []string

GetRunInfosF returns the list of run infos but only the ones that contains the pattern

func HaveBasicColors

func HaveBasicColors(input string) bool

func IsPrinterInterface

func IsPrinterInterface(msg interface{}) bool

func Left

func Left() string

func Margin

func Margin(margin int) string

func MarkupFilter

func MarkupFilter(msg string) string

MarkupFilter is the function that will be called by the Message function it handles the filtering of the message depending on the type of the message.

func Message

func Message(msg ...interface{}) []interface{}

Message is the function that will be called by the Print and PrintLn functions it handles the filtering and streaming of the message depending on the type of the message. so here er can also inject the filters and the output stream

func NewRoundSerial

func NewRoundSerial() *roundSerial

func NewTabCell

func NewTabCell(parent *tabRow) *tabCell

func NewTabRow

func NewTabRow(parent *tableHandle) *tabRow

func NewTableHandle

func NewTableHandle(parent *TabOut) *tableHandle

func Origin

func Origin(origin int) string

func Overflow

func Overflow(mode string) string

func OverflowContent

func OverflowContent(content string) string

func OverflowIgnore

func OverflowIgnore() string

func OverflowWordWrap

func OverflowWordWrap() string

func OverflowWrap

func OverflowWrap() string

func PadStrLeft

func PadStrLeft(line string, max int, fillChar string) string

PadStrLeft is a shortcut for PadString on a cell

func PadStrRight

func PadStrRight(line string, max int, fillChar string) string

PadStrRight is a shortcut for PadString on a cell

func PostMarkupFilter

func PostMarkupFilter(msgSlice []interface{}) []interface{}

func Print

func Print(msg ...interface{})

Print is parsing the message and then printing it by using the output interface if is defined or by using the fmt.Print function

func PrintLn

func PrintLn(msg ...interface{})

PrintLn is parsing the message and then printing it by using the output interface if is defined or by using the fmt.Println function

func Prop

func Prop(name string, value interface{}) string

Prop provides a way to create a property for a tab <tab prop='val'>

func Relative

func Relative() string
func Right() string

little helpers to set properties

func Round

func Round(percentage int, max int) int

func RoundHelp

func RoundHelp(percentage int, max int) (intResult int, result float64, rest float64)

func RoundHelpWithOffest

func RoundHelpWithOffest(percentage int, max int, offset float64) (intResult int, result float64, rest float64)

func Row

func Row(cells ...string) string

func SetBehavior

func SetBehavior(behave CtxOutBehavior)

func Size

func Size(size int) string

func StringCleanEscapeCodes

func StringCleanEscapeCodes(s string) string

func StringCut

func StringCut(s string, size int) (cutStr string, rest string)

splits a string into two parts. one part is the cut string, the other part is the rest the cut string is the first part of the string with the given size the rest is the remaining part of the string

func StringCutFromRight

func StringCutFromRight(s string, size int) (cutStr string, rest string)

splits a string into two parts. one part is the cut string, the other part is the rest the cut string is the last part of the string with the given size starting from the right side the rest is the remaining part of the string so if you have a string "1234567890" and you call StringCutFromRight("1234567890", 5) then the result will be "67890" and "12345"

func StringPure

func StringPure(s string) string

func TD

func TD(content interface{}, props ...string) string

TD provides a way to create a table cell <tab size='X'>content</tab>

func Tab

func Tab(size int) string

Table provides a way to create a table with size <table size='X'>

func TabF

func TabF(props ...string) string

TabF provides a way to create a tab with properties <tab prop1='val1' prop2='val2'>

func Table

func Table(rows ...string) string

func ToString

func ToString(msg ...interface{}) string

ToString is parsing the message into a string

func UniseqLen

func UniseqLen(s string) int

UniseqLen returns the length of a string, but only counts printable characters it ignores ANSI escape codes and also ignores the length of the ANSI escape codes

func UpdateFilterByName

func UpdateFilterByName(nameOfFilter string, info PostFilterInfo) error

func UpdateFilterByRef

func UpdateFilterByRef(filter PostFilter, info PostFilterInfo) error

func VisibleLen

func VisibleLen(s string) int

returns the length of a string, but only counts printable characters it ignores ANSI escape codes makes use of the ansi package from muesli

Types

type BasicColors

type BasicColors struct {

	// Foreground colors
	Black, Red, Green, Yellow, Blue, Magenta, Cyan, LightGrey, DarkGrey, LightRed, LightGreen, LightYellow, LightBlue, LightCyan, LightMagenta, White string
	// Background colors
	BackBlack, BackRed, BackGreen, BackYellow, BackBlue, BackMagenta, BackCyan, BackLightGrey, BackDarkGrey, BackLightRed, BackLightGreen, BackLightYellow, BackLightBlue, BackLightCyan, BackLightMagenta, BackWhite string
	// contains filtered or unexported fields
}

func NewBasicColors

func NewBasicColors() *BasicColors

func (*BasicColors) InitColors

func (bc *BasicColors) InitColors()

func (*BasicColors) IsBasicColor

func (bc *BasicColors) IsBasicColor(text string) bool

func (*BasicColors) ParseText

func (bc *BasicColors) ParseText(text string, handleColorCode func(m Parsed) string) string

type CtxOutBehavior

type CtxOutBehavior struct {
	NoColored bool
	ANSI      bool
	ANSI256   bool
	ANSI16M   bool
	Info      *PostFilterInfo
}

func GetBehavior

func GetBehavior() CtxOutBehavior

type CtxOutCtrl

type CtxOutCtrl struct {
	IgnoreCase bool
}

CtxOutCtrl is a control structure that can be used to control the output

type CtxOutLabel

type CtxOutLabel struct {
	Message interface{}
	FColor  string
}

CtxOutLabel is a control structure that can be used to control the output

type CursorFilter

type CursorFilter struct {
	// Info is the PostFilterInfo
	Info PostFilterInfo
	//Last error that occured
	LastError error
}

CursorFilter is a filter that sets the cursor position

func NewCursorFilter

func NewCursorFilter() *CursorFilter

func (*CursorFilter) CanHandleThis

func (t *CursorFilter) CanHandleThis(text string) bool

CanHandleThis returns true if the text is requesting a cursor position interface fulfills the PostFilter interface

func (*CursorFilter) Command

func (t *CursorFilter) Command(str string) string

func (*CursorFilter) Filter

func (t *CursorFilter) Filter(msg interface{}) interface{}

Filter is called when the context is updated interface fulfills the PostFilter interface

func (*CursorFilter) IsCursor

func (t *CursorFilter) IsCursor(text string) bool

Command is called when the text is a cursor position interface fulfills the PostFilter interface

func (*CursorFilter) Update

func (t *CursorFilter) Update(info PostFilterInfo)

Update is called when the context is updated interface fulfills the PostFilter interface

type FmtWarper

type FmtWarper struct {
}

func NewFmtWrap

func NewFmtWrap() *FmtWarper

func (*FmtWarper) Stream

func (f *FmtWarper) Stream(msg ...interface{})

func (*FmtWarper) StreamLn

func (f *FmtWarper) StreamLn(msg ...interface{})

type MOWrap

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

func NewMOWrap

func NewMOWrap() *MOWrap

func (*MOWrap) Filter

func (m *MOWrap) Filter(msg interface{}) interface{}

func (*MOWrap) GetInfo

func (m *MOWrap) GetInfo() CtxOutBehavior

func (*MOWrap) Update

func (m *MOWrap) Update(info CtxOutBehavior)

type Markup

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

general markup parser. this defines a single markup and NOT the markup itself so a markup is created by openeing the markup with START-TOKEN + something + END-TOKEN and closing it with START-TOKEN + CLOSE-IDENT + something + END-TOKEN the default markup is <something> and </something>

func NewMarkup

func NewMarkup() *Markup

NewMarkup creates a new markup parser with the default markup

func (*Markup) BuildInnerSlice

func (m *Markup) BuildInnerSlice(parsed []Parsed, outerMarkup string) ([]Parsed, []Parsed)

BuildInnerSlice builds a slice of Parsed elements from a slice of Parsed elements it searches for the outerMarkup and returns the inner slice of Parsed elements and the outer slice of Parsed elements

func (*Markup) BuildInnerSliceEach

func (m *Markup) BuildInnerSliceEach(parsed []Parsed, outerMarkup string, handleFn func(markup []Parsed) bool) []Parsed

BuildInnerSliceEach builds a slice of Parsed elements from a slice of Parsed elements it searches for the outerMarkup and returns the inner slice of Parsed elements and the outer slice of Parsed elements it calls the handleFn for each inner slice of Parsed elements if the handleFn returns false, the iteration stops

func (*Markup) Parse

func (m *Markup) Parse(orig string) []Parsed

Parse parses a string and returns a slice of Parsed elements

func (*Markup) SetAccepptedTags

func (m *Markup) SetAccepptedTags(tags []string) *Markup

SetAcceptedTags sets the accepted tags of a markup. anything else is ignored and parsed as content/text

func (*Markup) SetCloseIdent

func (m *Markup) SetCloseIdent(token rune) *Markup

SetCloseIdent sets the close identifier of a markup like / so the markup would looks like <something/>

func (*Markup) SetEndToken

func (m *Markup) SetEndToken(token rune) *Markup

SetEndToken sets the end token of a markup like > so the markup would looks like <something/>

func (*Markup) SetStartToken

func (m *Markup) SetStartToken(token rune) *Markup

SetStartToken sets the start token of a markup like < so the markup would looks like <something/>

type Parsed

type Parsed struct {
	IsMarkup bool   // flag if is plain text or a markup
	Text     string // the text of the parsed markup. this is on a markup like <something> the something. on a plain text it is the plain text
}

Parsed is a single parsed markup. it can be a plain text or a markup

func (*Parsed) GetMarkupIntValue

func (p *Parsed) GetMarkupIntValue(key string) (int, bool)

GetMarkupIntValue returns the int value of a markup for example if the markup is <something value='123'> and the key is value, it returns 123

func (*Parsed) GetMarkupStringValue

func (p *Parsed) GetMarkupStringValue(key string) (string, bool)

GetMarkupStringValue returns the string value of a markup for example if the markup is <something value='123'> and the key is value, it returns 123

func (*Parsed) GetProperty

func (p *Parsed) GetProperty(propertie string, defaultValue interface{}) interface{}

GetProperty returns the value of a property of a markup

type PostFilter

type PostFilter interface {
	Update(info PostFilterInfo)
	CanHandleThis(text string) bool
	Command(cmd string) string
}

PostFilter is an interface that can be used to filter the message after the markup filter they works only on strings

func GetPostFilter

func GetPostFilter(nameOfFilter string) PostFilter

func GetPostFilterbyRef

func GetPostFilterbyRef(filter PostFilter) PostFilter

func GetPostFilters

func GetPostFilters() []PostFilter

GetPostFilters returns the list of post filters

type PostFilterInfo

type PostFilterInfo struct {
	IsTerminal bool   // if the output is a terminal
	Colored    bool   // if the output can be colored
	Disabled   bool   // if the whole filter is enabled. the filter is still called, but it should not change the message. but remove the markup
	Width      int    // the width of the terminal
	Height     int    // the height of the terminal
	Id         string // the id of the filter

}

type PrintInterface

type PrintInterface interface {
	Update(info CtxOutBehavior)
	Filter(msg interface{}) interface{}
}

PrintInterface is an interface that can be used to filter the message

type Sign

type Sign struct {
	Name     string // name of the sign. used also as identifier
	Glyph    string // the utf-8 character
	Fallback string // the fallback string
}

defining an sign that can be used to display information as an sign. this sign is an utf-8 character. and a fallback string that is used if the device is not able to display the sign.

type SignFilter

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

func NewSignFilter

func NewSignFilter(signSet *SignSet) *SignFilter

NewSignFilter returns a new SignFilter if signSet is nil, the default signs are used

func (*SignFilter) AddSign

func (sf *SignFilter) AddSign(sign Sign) *SignFilter

func (*SignFilter) CanHandleThis

func (sf *SignFilter) CanHandleThis(text string) bool

the format for an sign is:

anything before <sign info> and anything afterwards <sign warning> and again anything afterwards

func (*SignFilter) Command

func (sf *SignFilter) Command(cmd string) string

func (*SignFilter) Disable

func (sf *SignFilter) Disable()

Disable disables the filter

func (*SignFilter) Enable

func (sf *SignFilter) Enable()

Enable enables the filter

func (*SignFilter) Enabled

func (sf *SignFilter) Enabled() bool

Enabled returns true if the filter is enabled

func (*SignFilter) ForceEmpty

func (sf *SignFilter) ForceEmpty(forceEmpty bool)

func (*SignFilter) GetSign

func (sf *SignFilter) GetSign(name string) Sign

func (*SignFilter) Update

func (sf *SignFilter) Update(info PostFilterInfo)

Update updates the filter with the new info

type SignSet

type SignSet struct {
	Signs []Sign
}

func NewBaseSignSet

func NewBaseSignSet() *SignSet

NewBaseSignSet returns a new SignSet with the basic signs

func (*SignSet) AddSign

func (s *SignSet) AddSign(sign Sign) error

AddSign adds an sign to the set

func (*SignSet) GetSign

func (s *SignSet) GetSign(name string) Sign

GetSign returns the sign with the given name

type StreamInterface

type StreamInterface interface {
	Stream(msg ...interface{})
	StreamLn(msg ...interface{})
}

StreamInterface is an interface that can be used to stream the message

type TabOut

type TabOut struct {
	RowCalcMode int // 0 = size is relative to with of terminal where maxsize is 100, 1 = absolute size
	// contains filtered or unexported fields
}

func NewTabOut

func NewTabOut() *TabOut

func (*TabOut) CanHandleThis

func (t *TabOut) CanHandleThis(text string) bool

CanHandleThis returns true if the text is a table interface fulfills the PostFilter interface

func (*TabOut) Clear

func (t *TabOut) Clear()

func (*TabOut) Command

func (t *TabOut) Command(cmd string) string

Command is called when the text is a table interface fulfills the PostFilter interface

func (*TabOut) Filter

func (t *TabOut) Filter(msg interface{}) interface{}

Filter is called when the context is updated interface fulfills the PostFilter interface

func (*TabOut) GetInfo

func (t *TabOut) GetInfo() PostFilterInfo

func (*TabOut) GetRoundTool

func (t *TabOut) GetRoundTool() *roundSerial

GetRoundTool returns the round tool what is used to calculate the size of the cells without rounding errors

func (*TabOut) GetSize

func (t *TabOut) GetSize(orig int) int

GetSize returns the size of the cell if the cell is relative to the terminal width, the size is calculated if the cell is absolute, the size is returned

func (*TabOut) IsRow

func (t *TabOut) IsRow(text string) bool

IsRow returns true if the text is a row

func (*TabOut) IsTab

func (t *TabOut) IsTab(text string) bool

IsTab returns true if the text is a tab cell

func (*TabOut) IsTable

func (t *TabOut) IsTable(text string) bool

IsTable returns true if the text is a table

func (*TabOut) RowParse

func (t *TabOut) RowParse(text string) string

similar to TableParse, but for a single row and we do not wait for a table end

func (*TabOut) ScanForCells

func (t *TabOut) ScanForCells(tokens []Parsed, table *tableHandle) *tabRow

func (*TabOut) ScanForRows

func (t *TabOut) ScanForRows(tokens []Parsed) *tableHandle

func (*TabOut) TableParse

func (t *TabOut) TableParse(text string) string

TableParse parses a table If a Table is created, we also enters table mode. In this mode the created table is not rendered until the table is closed.

func (*TabOut) Update

func (t *TabOut) Update(info PostFilterInfo)

Update is called when the context is updated interface fulfills the PostFilter interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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