showcom

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 the output writer, default is cutypes.Output
	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) ResetFormat added in v0.4.0

func (b *Base) ResetFormat()

ResetFormat marks the cached formatted output as stale.

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