cliio

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cliio provides utilities for printing output to the terminal including support for pagers and colored output.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Primary
	Heading = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#9333EA")).
			Bold(true)

	Accent = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#C026D3"))

	Error = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#F87171")).
			MarginRight(2).
			Bold(true)

	Warning = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#B084F5")).
			Bold(true)

	Info = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#A855F7"))

	Success = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#8BDAA0")).
			Bold(true)

	Debug = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#7C6FA6"))

	// Text
	Detail = lipgloss.NewStyle().
			Foreground(lipgloss.Color("#C4B5FD"))

	Dim = lipgloss.NewStyle().
		Foreground(lipgloss.Color("#6B6680"))
)

Functions

func PagerCmd

func PagerCmd(content string) (*exec.Cmd, bool)

func ResolvePagerCommand

func ResolvePagerCommand() (path string, args []string, ok bool)

func ShouldUsePagerFunc

func ShouldUsePagerFunc(str string, terminalHeight int) bool

Types

type Printer

type Printer interface {
	SetOut(out io.Writer)
	SetErrOut(errOut io.Writer)
	SetPagerMode(mode string) error
	Print(str string)
	Println(str string)
	PrintError(err error)
	PrintTime(time time.Duration)
	PrintViaPager(str string)
	ShouldUsePager(str string) bool
}

Printer defines terminal output behavior for regular, error, timed, and pager output.

func NewPgxPrinter

func NewPgxPrinter(out io.Writer, errOut io.Writer) Printer

NewPgxPrinter creates a printer with pager auto-detection.

Jump to

Keyboard shortcuts

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