output

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatTable = "table"
	FormatWide  = "wide"
	FormatJSON  = "json"
	FormatCSV   = "csv"
)

Format constants for output modes.

Variables

View Source
var (
	StyleNew        = lipgloss.NewStyle().Foreground(lipgloss.Color("10"))
	StyleInProgress = lipgloss.NewStyle().Foreground(lipgloss.Color("11"))
	StyleResolved   = lipgloss.NewStyle().Foreground(lipgloss.Color("12"))
	StyleClosed     = lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
	StyleRejected   = lipgloss.NewStyle().Foreground(lipgloss.Color("9"))

	StyleHighPrio   = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Bold(true)
	StyleNormalPrio = lipgloss.NewStyle().Foreground(lipgloss.Color("7"))
	StyleLowPrio    = lipgloss.NewStyle().Foreground(lipgloss.Color("8"))

	StyleID      = lipgloss.NewStyle().Foreground(lipgloss.Color("6")).Bold(true)
	StyleHeader  = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("15"))
	StyleLabel   = lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
	StyleSuccess = lipgloss.NewStyle().Foreground(lipgloss.Color("10"))
	StyleError   = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).Bold(true)
	StyleWarning = lipgloss.NewStyle().Foreground(lipgloss.Color("11"))
)

Functions

func IsTerminal

func IsTerminal() bool

IsTerminal checks if stdout is a terminal.

func PriorityStyle

func PriorityStyle(name string) lipgloss.Style

PriorityStyle returns the appropriate style for a priority name.

func RenderCSV

func RenderCSV(w io.Writer, headers []string, rows [][]string) error

RenderCSV renders headers and rows as CSV to the writer.

func RenderJSON

func RenderJSON(w io.Writer, v interface{}) error

RenderJSON renders a value as pretty-printed JSON to the writer.

func RenderTable

func RenderTable(w io.Writer, headers []string, rows [][]string, noColor bool)

RenderTable renders a table with headers and rows to the writer.

func StartSpinner

func StartSpinner(msg string, isTTY bool) func()

StartSpinner starts a spinner with the given message and returns a stop function.

func StatusStyle

func StatusStyle(name string) lipgloss.Style

StatusStyle returns the appropriate style for a status name.

Types

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue is a label-value pair for detail views.

type Printer

type Printer interface {
	Table(headers []string, rows [][]string)
	Detail(pairs []KeyValue)
	JSON(v interface{})
	CSV(headers []string, rows [][]string)
	Success(msg string)
	Error(msg string)
	Warning(msg string)
	Spinner(msg string) func()
	Format() string
}

Printer handles all output rendering.

type StdPrinter

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

StdPrinter is the standard implementation of Printer.

func NewStdPrinter

func NewStdPrinter(out, errOut io.Writer, isTTY, noColor bool, format string) *StdPrinter

NewStdPrinter creates a new StdPrinter.

func (*StdPrinter) CSV

func (p *StdPrinter) CSV(headers []string, rows [][]string)

func (*StdPrinter) Detail

func (p *StdPrinter) Detail(pairs []KeyValue)

func (*StdPrinter) Error

func (p *StdPrinter) Error(msg string)

func (*StdPrinter) Format

func (p *StdPrinter) Format() string

func (*StdPrinter) JSON

func (p *StdPrinter) JSON(v interface{})

func (*StdPrinter) Spinner

func (p *StdPrinter) Spinner(msg string) func()

func (*StdPrinter) Success

func (p *StdPrinter) Success(msg string)

func (*StdPrinter) Table

func (p *StdPrinter) Table(headers []string, rows [][]string)

func (*StdPrinter) Warning

func (p *StdPrinter) Warning(msg string)

Jump to

Keyboard shortcuts

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