Help us shape the future of Go! Take the 2026 Go Developer Survey

pterm

package
v1.3.104-alpha1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pterm cmd/skywire-cli/cliutil/pterm/pterm.go c5-cli-util

The ANSI colors and box-drawing tree the CLI used from github.com/pterm/pterm, with the same output. pterm's keyboard dependency does not build for js.

Index

Constants

This section is empty.

Variables

View Source
var (
	Red     = func(a ...interface{}) string { return sgr("31", a...) }
	Green   = func(a ...interface{}) string { return sgr("32", a...) }
	Blue    = func(a ...interface{}) string { return sgr("34", a...) }
	Cyan    = func(a ...interface{}) string { return sgr("36", a...) }
	Magenta = func(a ...interface{}) string { return sgr("35", a...) }
	Yellow  = func(a ...interface{}) string { return sgr("33", a...) }
	White   = func(a ...interface{}) string { return sgr("37", a...) }
	Black   = func(a ...interface{}) string { return sgr("30", a...) }
)

Sprint-style color functions.

View Source
var (
	BgRed     = Style{"41"}
	BgBlue    = Style{"44"}
	BgMagenta = Style{"45"}
)

Background styles.

View Source
var DefaultTree = TreePrinter{}

DefaultTree is the zero-config tree printer.

Functions

func Println

func Println(a ...interface{})

Println prints the arguments and a newline.

Types

type LeveledList

type LeveledList []LeveledListItem

LeveledList is a list of leveled items.

type LeveledListItem

type LeveledListItem struct {
	Level int
	Text  string
}

LeveledListItem is one indentation-leveled line.

type Style added in v1.3.101

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

Style is a background style; its Sprint wraps arguments in the SGR code.

func (Style) Sprint added in v1.3.101

func (s Style) Sprint(a ...interface{}) string

Sprint renders the arguments under the style.

type TreeNode

type TreeNode struct {
	Children []TreeNode
	Text     string
}

TreeNode is one node of a renderable tree.

type TreePrinter added in v1.3.101

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

TreePrinter renders a TreeNode with gray box-drawing branches.

func (*TreePrinter) Render added in v1.3.101

func (t *TreePrinter) Render() error

Render prints the tree and a blank line.

func (*TreePrinter) Srender added in v1.3.101

func (t *TreePrinter) Srender() string

Srender returns the rendered tree.

func (TreePrinter) WithRoot added in v1.3.101

func (t TreePrinter) WithRoot(n TreeNode) *TreePrinter

WithRoot returns a printer for the given root.

Jump to

Keyboard shortcuts

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