output

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package output provides formatting utilities for CLI output.

This package supports multiple output formats:

  • JSON (pretty-printed and compact) for LLM-friendly structured output
  • Colored text for terminal display using lipgloss styles

All commands in the CLI support a --json flag that uses this package to emit structured output suitable for parsing by other tools or LLMs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// StatusColors for issue/workflow statuses (aligned with Jira status categories)
	StatusToDo       = lipgloss.NewStyle().Foreground(lipgloss.Color("245")) // Gray
	StatusInProgress = lipgloss.NewStyle().Foreground(lipgloss.Color("33"))  // Blue
	StatusDone       = lipgloss.NewStyle().Foreground(lipgloss.Color("35"))  // Green
	StatusBlocked    = lipgloss.NewStyle().Foreground(lipgloss.Color("196")) // Red

	// Priority colors
	PriorityHighest = lipgloss.NewStyle().Foreground(lipgloss.Color("196")) // Red
	PriorityHigh    = lipgloss.NewStyle().Foreground(lipgloss.Color("208")) // Orange
	PriorityMedium  = lipgloss.NewStyle().Foreground(lipgloss.Color("220")) // Yellow
	PriorityLow     = lipgloss.NewStyle().Foreground(lipgloss.Color("33"))  // Blue
	PriorityLowest  = lipgloss.NewStyle().Foreground(lipgloss.Color("245")) // Gray

	// General styles
	Bold      = lipgloss.NewStyle().Bold(true)
	Faint     = lipgloss.NewStyle().Faint(true)
	Success   = lipgloss.NewStyle().Foreground(lipgloss.Color("35"))  // Green
	Warning   = lipgloss.NewStyle().Foreground(lipgloss.Color("220")) // Yellow
	Error     = lipgloss.NewStyle().Foreground(lipgloss.Color("196")) // Red
	Info      = lipgloss.NewStyle().Foreground(lipgloss.Color("33"))  // Blue
	Cyan      = lipgloss.NewStyle().Foreground(lipgloss.Color("51"))  // Cyan
	Highlight = lipgloss.NewStyle().Foreground(lipgloss.Color("141")) // Purple

	// Link style
	Link = lipgloss.NewStyle().Foreground(lipgloss.Color("33")).Underline(true)
)

Color styles for CLI output using lipgloss. These styles are used to add visual distinction to different types of information in terminal output. Colors are chosen to be consistent with common conventions:

  • Green for success/done states
  • Blue for in-progress/info states
  • Yellow for warnings/medium priority
  • Red for errors/blocked/high priority
  • Gray for low priority/faint text

Functions

func JSON

func JSON(w io.Writer, data interface{}) error

JSON writes data as pretty-printed JSON to the writer with 2-space indentation. This is the standard output format when --json flag is used.

func JSONCompact

func JSONCompact(w io.Writer, data interface{}) error

JSONCompact writes data as compact JSON (no indentation) to the writer. Useful when output size matters more than human readability.

func JSONString

func JSONString(data interface{}) (string, error)

JSONString returns data as a pretty-printed JSON string. Useful when you need the JSON as a string rather than writing to a stream.

func SimpleTable

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

SimpleTable creates and renders a simple table in one call.

func StylePriority

func StylePriority(priority string) string

StylePriority returns a styled string based on Jira priority name. Priority colors follow severity conventions:

  • "Highest", "Blocker" → Red
  • "High", "Critical" → Orange
  • "Medium" → Yellow
  • "Low" → Blue
  • "Lowest", "Trivial" → Gray

Unknown priorities return the priority unchanged.

func StyleStatus

func StyleStatus(status string, category string) string

StyleStatus returns a styled string based on Jira status category. The category comes from the Jira API's statusCategory.key field:

  • "new", "undefined" → Gray (To Do)
  • "indeterminate" → Blue (In Progress)
  • "done" → Green (Done)

Unknown categories return the status unchanged.

Types

type Table

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

Table renders data as a table.

func NewTable

func NewTable(w io.Writer, opts TableOptions) *Table

NewTable creates a new table writer.

func (*Table) AddRow

func (t *Table) AddRow(row ...string)

AddRow adds a row to the table.

func (*Table) Render

func (t *Table) Render()

Render writes the table to the output.

type TableOptions

type TableOptions struct {
	Header    []string
	NoHeader  bool
	Separator string
}

TableOptions configures table output.

Jump to

Keyboard shortcuts

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