Documentation
¶
Index ¶
- Constants
- Variables
- func IsTerminal() bool
- func PriorityStyle(name string) lipgloss.Style
- func RenderCSV(w io.Writer, headers []string, rows [][]string) error
- func RenderJSON(w io.Writer, v interface{}) error
- func RenderTable(w io.Writer, headers []string, rows [][]string, noColor bool)
- func StartSpinner(msg string, isTTY bool) func()
- func StatusStyle(name string) lipgloss.Style
- type KeyValue
- type Printer
- type StdPrinter
- func (p *StdPrinter) CSV(headers []string, rows [][]string)
- func (p *StdPrinter) Detail(pairs []KeyValue)
- func (p *StdPrinter) Error(msg string)
- func (p *StdPrinter) Format() string
- func (p *StdPrinter) JSON(v interface{})
- func (p *StdPrinter) Spinner(msg string) func()
- func (p *StdPrinter) Success(msg string)
- func (p *StdPrinter) Table(headers []string, rows [][]string)
- func (p *StdPrinter) Warning(msg string)
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 PriorityStyle ¶
PriorityStyle returns the appropriate style for a priority name.
func RenderJSON ¶
RenderJSON renders a value as pretty-printed JSON to the writer.
func RenderTable ¶
RenderTable renders a table with headers and rows to the writer.
func StartSpinner ¶
StartSpinner starts a spinner with the given message and returns a stop function.
func StatusStyle ¶
StatusStyle returns the appropriate style for a status name.
Types ¶
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)
Click to show internal directories.
Click to hide internal directories.