display

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorCyan   = color.New(color.FgHiCyan, color.Bold)
	ColorPurple = color.New(color.FgHiMagenta, color.Bold)
	ColorOrange = color.New(color.FgYellow, color.Bold) // closest to #FFAA7F
	ColorGreen  = color.New(color.FgHiGreen, color.Bold)
	ColorRed    = color.New(color.FgHiRed, color.Bold)
	ColorBold   = color.New(color.Bold)
	ColorWhite  = color.New(color.FgHiWhite, color.Bold)
	ColorDim    = color.New(color.Faint)
)

Functions

func Error

func Error(msg string)

Error prints a red error line to stderr.

func GistInfo

func GistInfo(desc, id, url string)

GistInfo pretty-prints gist metadata after create/update.

func ListGists added in v1.0.1

func ListGists(rows []GistRow, cfg Config)

ListGists is the main entry point for rendering the gist list. It auto-selects between table mode and compact list mode based on the current terminal width vs cfg.MinTableWidth.

func Prompt

func Prompt(msg string) string

Prompt prints a styled prompt and reads a trimmed line from stdin.

func Success

func Success(msg string)

Success prints a green success line.

func TermWidth added in v1.0.1

func TermWidth() int

TermWidth returns the current terminal width, falling back to 120.

Types

type Config added in v1.0.1

type Config struct {
	MinTableWidth int // terminal columns below which list mode is used
	DescRatio     int // % of flexible width for Description column (1–99)
}

DisplayConfig is a subset of config.DisplayConfig re-declared here to avoid an import cycle. The caller (cmd/list.go) maps config.DisplayConfig → this.

type GistRow

type GistRow struct {
	Index       string
	ID          string
	Description string
	URL         string
}

GistRow is one row for the list table.

Jump to

Keyboard shortcuts

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