console

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 13 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 标题 : ⠇ 100.00%
	THEME_CIRCLE_LIGHT   = *NewProgressCircleTheme(strings.Split("⠇⠋⠉⠙⠸⠴⠤⠦", ""), DEFAULT_PBR_TEMPLATE)
	THEME_CIRCLE_CONCISE = *NewProgressCircleTheme(strings.Split("|/-\\", ""), DEFAULT_PBR_TEMPLATE)
)
View Source
var (
	// 标题 : ━━━━━━━━━━━━━━━━━━━━━━ 100.00%
	THEME_LIGHT = *NewProgressBarTheme("━", DEFAULT_PBR_TEMPLATE)
	// 标题 : ====================== 100.00%
	THEME_CONCISE = *NewProgressBarTheme("=", DEFAULT_PBR_TEMPLATE)
	// 标题 : ☁️☁️☁️☁️🛬             100.00%
	THEME_EMOJI_AIRPLANE = *NewProgressBarTheme("☁️", DEFAULT_PBR_TEMPLATE).SetTopchar("🛬")
	// 标题 : ❤️❤️❤️❤️❤️             100.00%
	THEME_EMOJI_HEART = *NewProgressBarTheme("❤️", DEFAULT_PBR_TEMPLATE).SetTopchar("❤️")
)
View Source
var DEFAULT_PBR_TEMPLATE = "{{.Title}}: {{.Progress}} {{.Percent}}"

Functions

func Debug

func Debug(msg string, args ...interface{})

func DebugS

func DebugS(msg string, args ...interface{})

func DefultLog

func DefultLog() *slog.Logger

func EnableLogDebug

func EnableLogDebug()

func Error

func Error(msg string, args ...interface{})

func ErrorS

func ErrorS(msg string, args ...interface{})

func Fatal added in v0.0.3

func Fatal(msg string, args ...interface{})

func FatalS added in v0.0.3

func FatalS(msg string, args ...interface{})

func Info

func Info(msg string, args ...interface{})

func InfoS

func InfoS(msg string, args ...interface{})

func PkgDisablePkgLog added in v0.0.5

func PkgDisablePkgLog()

func PkgEnableLog added in v0.0.5

func PkgEnableLog()

func Print

func Print(a ...any)

func Printf

func Printf(format string, v ...any)

func Println

func Println(a ...any)

func ProgressCount added in v0.0.5

func ProgressCount() int

func SetLogFile

func SetLogFile(file string)

func Success added in v0.0.3

func Success(msg string, args ...interface{})

func SuccessS added in v0.0.3

func SuccessS(msg string, args ...interface{})

func WaitAllProgressBar added in v0.0.5

func WaitAllProgressBar()

func Warn

func Warn(msg string, args ...interface{})

func WarnS

func WarnS(msg string, args ...interface{})

Types

type ConsoleHandler

type ConsoleHandler struct {
	*slog.TextHandler
}

func (*ConsoleHandler) Handle

func (h *ConsoleHandler) Handle(ctx context.Context, r slog.Record) error

type PbrGroup added in v0.0.5

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

func (*PbrGroup) Add added in v0.0.5

func (m *PbrGroup) Add(pbr ProgressBar)

func (*PbrGroup) Output added in v0.0.5

func (m *PbrGroup) Output()

func (*PbrGroup) Reset added in v0.0.5

func (m *PbrGroup) Reset()

type ProgressBar added in v0.0.5

type ProgressBar interface {
	IsDone() bool
	GetTitle() string
	Render(titleWidth, progressWidth int) string
}

type ProgressBarTheme added in v0.0.5

type ProgressBarTheme struct {
	Char string
	// contains filtered or unexported fields
}

func NewProgressBarTheme added in v0.0.5

func NewProgressBarTheme(char string, templateArg ...string) *ProgressBarTheme

func (ProgressBarTheme) Render added in v0.0.5

func (p ProgressBarTheme) Render(title string, percent float64, titleWidth int, progressWidth int) string

func (*ProgressBarTheme) SetTopchar added in v0.0.5

func (p *ProgressBarTheme) SetTopchar(topChar string) *ProgressBarTheme

func (*ProgressBarTheme) Topchar added in v0.0.5

func (p *ProgressBarTheme) Topchar() string

type ProgressCircle added in v0.0.5

type ProgressCircle struct {
	Title string
	// contains filtered or unexported fields
}

func NewProgressCircle added in v0.0.5

func NewProgressCircle(title string, opt ...ProgressCircleTheme) *ProgressCircle

func (*ProgressCircle) ForceDone added in v0.0.5

func (p *ProgressCircle) ForceDone()

func (*ProgressCircle) GetTitle added in v0.0.5

func (p *ProgressCircle) GetTitle() string

func (*ProgressCircle) Increment added in v0.0.5

func (p *ProgressCircle) Increment()

func (*ProgressCircle) IncrementN added in v0.0.5

func (p *ProgressCircle) IncrementN(n int)

func (*ProgressCircle) IsDone added in v0.0.5

func (p *ProgressCircle) IsDone() bool

func (*ProgressCircle) Render added in v0.0.5

func (p *ProgressCircle) Render(titleWidth, progressWidth int) string

type ProgressCircleTheme added in v0.0.5

type ProgressCircleTheme struct {
	Chars []string
	// contains filtered or unexported fields
}

func NewProgressCircleTheme added in v0.0.5

func NewProgressCircleTheme(chars []string, templateArg ...string) *ProgressCircleTheme

func (*ProgressCircleTheme) Render added in v0.0.5

func (p *ProgressCircleTheme) Render(title string, progress int, titleWidth int, progressWidth int) string

type ProgressLinear added in v0.0.5

type ProgressLinear struct {
	Total int
	Title string
	// contains filtered or unexported fields
}

func NewProgressLinear added in v0.0.5

func NewProgressLinear(total int, title string, opt ...ProgressBarTheme) *ProgressLinear

func (*ProgressLinear) ForceDone added in v0.0.5

func (p *ProgressLinear) ForceDone()

func (ProgressLinear) GetTitle added in v0.0.5

func (p ProgressLinear) GetTitle() string

func (*ProgressLinear) Increment added in v0.0.5

func (p *ProgressLinear) Increment()

func (*ProgressLinear) IncrementN added in v0.0.5

func (p *ProgressLinear) IncrementN(n int)

func (*ProgressLinear) IsDone added in v0.0.5

func (p *ProgressLinear) IsDone() bool

func (*ProgressLinear) Percent added in v0.0.5

func (p *ProgressLinear) Percent() float64

func (ProgressLinear) Render added in v0.0.5

func (p ProgressLinear) Render(titleWidth, progressWidth int) string

Jump to

Keyboard shortcuts

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