showcom

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OK success exit code
	OK = 0
	// ERR error exit code
	ERR = 2
)
View Source
const PosCenter = PosMiddle

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	// out  comdef.ByteStringWriter
	// TODO lock sync.Mutex
	Out io.Writer
	// Buf store formatted string
	Buf *bytes.Buffer
	Err error
	// FormatFn function
	FormatFn FormatFunc
	// contains filtered or unexported fields
}

Base formatter. NOTE: must config the FormatFn before use

func (*Base) Buffer

func (b *Base) Buffer() *bytes.Buffer

Buffer get buffer instance

func (*Base) InitBuffer

func (b *Base) InitBuffer()

InitBuffer instance

func (*Base) Print

func (b *Base) Print()

Print formatted message

func (*Base) Println

func (b *Base) Println()

Println formatted message and print newline

func (*Base) SetBuffer

func (b *Base) SetBuffer(buf *bytes.Buffer)

SetBuffer field

func (*Base) SetErr

func (b *Base) SetErr(err error)

SetErr set error

func (*Base) SetOutput

func (b *Base) SetOutput(out io.Writer)

SetOutput for print message

func (*Base) String

func (b *Base) String() string

String format given data to string

func (*Base) WriteTo

func (b *Base) WriteTo(w io.Writer) (int64, error)

WriteTo format to string and write to w.

type FormatFunc

type FormatFunc func()

func (FormatFunc) Format

func (fn FormatFunc) Format()

Format implement FormatterFace

type Formatter

type Formatter interface {
	Format()
}

Formatter interface

type OverflowFlag

type OverflowFlag uint8

OverflowFlag for handling content overflow. 0=auto, 1=cut, 2=wrap

const (
	OverflowAuto OverflowFlag = iota // auto
	OverflowCut                      // 截断
	OverflowWrap                     // 换行
)

OverflowFlag values

type PosFlag

type PosFlag = strutil.PosFlag

PosFlag type

const (
	PosLeft PosFlag = iota
	PosMiddle
	PosRight
)

some position constants

type ShownFace

type ShownFace interface {

	// String data to string
	String() string
	// Print print current message
	Print()
	// Println print current message
	Println()
}

ShownFace shown interface

Jump to

Keyboard shortcuts

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