Documentation ¶
Index ¶
- func FindTransformer(transformerName string) func(Segment) Segment
- type Segment
- func (s Segment) Concat(v interface{}) (interface{}, error)
- func (s Segment) Index(k interface{}) (v interface{}, ok bool)
- func (s Segment) IterateKeys(fn func(v interface{}) bool)
- func (Segment) Kind() string
- func (s Segment) RConcat(v interface{}) (interface{}, error)
- func (s Segment) Repr(indent int) string
- func (s Segment) ToLegacyType() *ui.Styled
- type Style
- type Text
- func (t Text) Concat(v interface{}) (interface{}, error)
- func (t Text) Index(k interface{}) (interface{}, error)
- func (t Text) IterateKeys(fn func(interface{}) bool)
- func (t Text) Kind() string
- func (t Text) Partition(indicies ...int) []Text
- func (t Text) RConcat(v interface{}) (interface{}, error)
- func (t Text) Repr(indent int) string
- func (t Text) String() string
- func (t Text) ToLegacyType() []*ui.Styled
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindTransformer ¶
FindTransformer looks up a transformer name and if successful returns a function that can be used to transform a styled Segment.
Types ¶
type Segment ¶
Segment is a string that has some style applied to it.
func (Segment) IterateKeys ¶
func (Segment) Repr ¶
Repr returns the representation of this Segment. The string can be used to construct an identical Segment. Unset or default attributes are skipped. If the Segment represents an unstyled string only this string is returned.
func (Segment) ToLegacyType ¶
type Style ¶
type Style struct { Foreground string Background string Bold bool Dim bool Italic bool Underlined bool Blink bool Inverse bool }
Style specifies how something (mostly a string) shall be displayed.
func (*Style) ImportFromOptions ¶
ImportFromOptions assigns all recognized values from a map to the current Style.
type Text ¶
type Text []Segment
Text contains of a list of styled Segments.
func (Text) IterateKeys ¶
func (Text) Repr ¶
Repr returns the representation of the current Text. It is just a wrapper around the containing Segments.
func (Text) String ¶
todo: Make string conversion variable to environment. E.g. the shell displays colors different than HTML.