formatter

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectEncoding

func DetectEncoding(formatter OutputFormatterInferface, str string) string

TODO: implement

func Escape

func Escape(s string) string

func EscapeTrailingBackslash

func EscapeTrailingBackslash(s string) string

func FormatBlock

func FormatBlock(messages []string, style string, large bool) string

func FormatSection

func FormatSection(section string, message string, style string) string

func RemoveDecoration

func RemoveDecoration(formatter OutputFormatterInferface, str string) string

func Truncate

func Truncate(message string, length int, suffix string) string

Types

type OutputFormatter

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

func NewOutputFormatter

func NewOutputFormatter(decorated bool, styles map[string]OutputFormatterStyleInterface) *OutputFormatter

func (*OutputFormatter) Clone

func (*OutputFormatter) Format

func (o *OutputFormatter) Format(message string) string

func (*OutputFormatter) FormatAndWrap

func (o *OutputFormatter) FormatAndWrap(message string, width int) string

func (*OutputFormatter) HasStyle

func (o *OutputFormatter) HasStyle(name string) bool

func (*OutputFormatter) IsDecorated

func (o *OutputFormatter) IsDecorated() bool

func (*OutputFormatter) SetDecorated

func (o *OutputFormatter) SetDecorated(decorated bool)

func (*OutputFormatter) SetStyle

func (o *OutputFormatter) SetStyle(name string, style OutputFormatterStyleInterface)

func (*OutputFormatter) Style

func (*OutputFormatter) StyleStack

func (o *OutputFormatter) StyleStack() *OutputFormatterStyleStack

type OutputFormatterInferface

type OutputFormatterInferface interface {
	SetDecorated(decorated bool)
	IsDecorated() bool
	SetStyle(name string, style OutputFormatterStyleInterface)
	HasStyle(name string) bool
	Style(name string) (OutputFormatterStyleInterface, error)
	Format(message string) string
	Clone() OutputFormatterInferface
}

type OutputFormatterStyle

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

func NewOutputFormatterStyle

func NewOutputFormatterStyle(foreground string, background string, options []string) *OutputFormatterStyle

func (*OutputFormatterStyle) Apply

func (s *OutputFormatterStyle) Apply(text string) string

func (*OutputFormatterStyle) Clone

func (*OutputFormatterStyle) SetBackground

func (s *OutputFormatterStyle) SetBackground(c string)

func (*OutputFormatterStyle) SetForeground

func (s *OutputFormatterStyle) SetForeground(c string)

func (*OutputFormatterStyle) SetHref

func (s *OutputFormatterStyle) SetHref(href string)

func (*OutputFormatterStyle) SetOption

func (s *OutputFormatterStyle) SetOption(option string)

func (*OutputFormatterStyle) SetOptions

func (s *OutputFormatterStyle) SetOptions(options []string)

func (*OutputFormatterStyle) UnsetOption

func (s *OutputFormatterStyle) UnsetOption(option string)

type OutputFormatterStyleInterface

type OutputFormatterStyleInterface interface {
	SetForeground(color string)
	SetBackground(color string)
	SetOption(option string)
	UnsetOption(option string)
	SetOptions(options []string)
	Apply(text string) string
	Clone() OutputFormatterStyleInterface
}

type OutputFormatterStyleStack

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

func NewOutputFormatterStyleStack

func NewOutputFormatterStyleStack(emptyStyle OutputFormatterStyleInterface) *OutputFormatterStyleStack

func (*OutputFormatterStyleStack) Clone

func (*OutputFormatterStyleStack) Current

func (*OutputFormatterStyleStack) EmptyStyle

func (*OutputFormatterStyleStack) Pop

func (*OutputFormatterStyleStack) Push

func (*OutputFormatterStyleStack) Reset

func (s *OutputFormatterStyleStack) Reset()

func (*OutputFormatterStyleStack) SetEmptyStyle

type WrappableOutputFormatterInterface

type WrappableOutputFormatterInterface interface {
	FormatAndWrap(message string, width int) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳