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 ¶
- Variables
- func JSON(w io.Writer, data interface{}) error
- func JSONCompact(w io.Writer, data interface{}) error
- func JSONString(data interface{}) (string, error)
- func SimpleTable(w io.Writer, headers []string, rows [][]string)
- func StylePriority(priority string) string
- func StyleStatus(status string, category string) string
- type Table
- type TableOptions
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
JSONCompact writes data as compact JSON (no indentation) to the writer. Useful when output size matters more than human readability.
func JSONString ¶
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 ¶
SimpleTable creates and renders a simple table in one call.
func StylePriority ¶
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 ¶
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.
type TableOptions ¶
TableOptions configures table output.