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

pterm

package
v1.3.97 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

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

js/wasm implementation of the shadow: plain ANSI SGR codes and a simple box-drawing tree renderer, no pterm import (pterm's keyboard dependency does not build for js). Output is functionally equivalent for the color and tree surface the CLI uses.

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 mirrors fmt.Println (pterm.Println adds theming; plain is fine).

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

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

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

func (Style) Sprint

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

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

TreePrinter renders a TreeNode with box-drawing branches.

func (*TreePrinter) Render

func (t *TreePrinter) Render() error

Render prints the tree.

func (TreePrinter) WithRoot

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