text

package
v0.0.0-...-dbaf2e2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(text string, opt ...Option) string

Convert converts a plain text into another text with options.

Types

type Border

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

Border implements BorderStyle to receive a border style.

func (*Border) Corner

func (b *Border) Corner() Corner

Corner is the corner of border.

func (*Border) LineSplitter

func (b *Border) LineSplitter() LineSplitter

LineSplitter describes a line splitter in horizontal and vertical.

type BorderStyle

type BorderStyle interface {
	Corner() Corner
	LineSplitter() LineSplitter
}

BorderStyle is an interface which describes a border style for log print.

type Corner

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

Corner describes the character for left side corner.

type Frame

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

Frame is a text render with options, such as render with border, or with prefix.

func NewFrame

func NewFrame(rows []*Row, opt ...Option) *Frame

NewFrame creates an instance of Frame.

func (*Frame) Print

func (f *Frame) Print()

Print prints a text on terminal.

type LineSplitter

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

LineSplitter describes the splitter in horizontal and vertica direction.

type NoneBorder

type NoneBorder struct{}

NoneBorder implements BorderStyle represents borderless.

func (*NoneBorder) Corner

func (b *NoneBorder) Corner() Corner

Corner is the corner of border.

func (*NoneBorder) LineSplitter

func (b *NoneBorder) LineSplitter() LineSplitter

LineSplitter describes a line splitter in horizontal and vertical.

type Option

type Option func(f *Frame)

Option is an alias of the function with argument Frame .

func DisableBorder

func DisableBorder() Option

DisableBorder represents that is disable border.

func WithBorder

func WithBorder(leftTop, leftBottom, horizontal, vertical string) Option

WithBorder creates an Option from arguments.

func WithCommonBorder

func WithCommonBorder(char string) Option

WithCommonBorder creates a Border Option which have the same character.

func WithDotStyle

func WithDotStyle() Option

WithDotStyle describes a dot style for border.

func WithDoubleLine

func WithDoubleLine() Option

WithDoubleLine describes a double line style for border.

func WithFivePointedStarStyle

func WithFivePointedStarStyle() Option

WithFivePointedStarStyle describes a file-pointed star style for border.

func WithLineStyle

func WithLineStyle() Option

WithLineStyle describes a line style for border.

func WithPlusStyle

func WithPlusStyle() Option

WithPlusStyle describes a plus style for border.

func WithPrefix

func WithPrefix(prefix ...string) Option

WithPrefix creates a prefix Option.

func WithStarStyle

func WithStarStyle() Option

WithStarStyle describes a star style for border.

type Row

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

Row describes a log row.

func NewRows

func NewRows(text ...string) []*Row

NewRows creates an instance of Row.

Jump to

Keyboard shortcuts

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