output

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package output provides display helpers for consistent CLI output

Package output provides formatters for CLI output

Package output provides shared formatting helpers for CLI output

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(msg string)

Alert prints a bold yellow alert message: ⚠ message

func Alertf

func Alertf(format string, a ...interface{})

Alertf prints a bold yellow formatted alert message: ⚠ message

func BoolYesNo

func BoolYesNo(b bool) string

BoolYesNo returns "Yes" or "No" for boolean display

func Bullet

func Bullet(text string)

Bullet prints a bulleted list item.

  • item text

func Bulletf

func Bulletf(format string, a ...interface{})

Bulletf prints a formatted bulleted list item.

func Dim

func Dim(text string)

Dim prints dimmed/secondary text.

func Dimf

func Dimf(format string, a ...interface{})

Dimf prints formatted dimmed/secondary text.

func Empty

func Empty(msg, suggestion string)

Empty prints a helpful empty-state message with a suggested next action.

No clients found
  Add one with: gitscrum clients create "Name"

func EmptyContext

func EmptyContext(resource, workspace, project, suggestion string)

EmptyContext prints an empty-state message with workspace/project context. Use this for project-scoped resources like tasks, sprints, wiki pages.

No tasks found in project "my-project" (workspace: my-workspace)
  Create one with: gitscrum tasks create "Task title"

func EmptyDefault

func EmptyDefault(s, defaultVal string) string

EmptyDefault returns the default value if the string is empty

func Error

func Error(msg string)

Error prints a red error message: ✗ message

func Errorf

func Errorf(format string, a ...interface{})

Errorf prints a red formatted error message: ✗ message

func FormatDate

func FormatDate(dateStr string) string

FormatDate formats an ISO 8601 date string for display

func FormatDuration

func FormatDuration(hours float64) string

FormatDuration formats a duration in hours/minutes for display

func FormatMoney

func FormatMoney(symbol string, amount float64) string

FormatMoney formats a monetary amount with currency symbol.

func FormatStatInline

func FormatStatInline(label string, value interface{}) string

FormatStatInline formats a label:value pair for use in StatLine.

func Header(title string)

Header prints a bold section header with a separator line.

┃ CRM Dashboard
┃ ────────────────────────────

func Info

func Info(msg string)

Info prints a cyan info message: ● message

func Infof

func Infof(format string, a ...interface{})

Infof prints a cyan formatted info message: ● message

func KeyValue

func KeyValue(key, value string)

KeyValue prints an aligned key-value pair.

Workspace: my-workspace

func KeyValuef

func KeyValuef(key, format string, a ...interface{})

KeyValuef prints a formatted key-value pair.

func PriorityLabel

func PriorityLabel(priority int) string

PriorityLabel returns a human-readable priority label

func Separator

func Separator()

Separator prints a thin separator line.

func Stat

func Stat(label string, value interface{})

Stat prints an inline stat with label and value.

Active: 42

func StatLine

func StatLine(stats ...string)

StatLine prints a line of multiple stats separated by " │ "

func StatusIcon

func StatusIcon(status string) string

StatusIcon returns a text-based status icon for display

func StripHTML

func StripHTML(html string) string

StripHTML removes HTML tags and converts to plain text for terminal display

func SubHeader

func SubHeader(title string)

SubHeader prints a section sub-header (dimmer than Header).

Summary

func Success

func Success(msg string)

Success prints a green success message: ✓ message

func Successf

func Successf(format string, a ...interface{})

Successf prints a green formatted success message: ✓ message

func Truncate

func Truncate(s string, maxLen int) string

Truncate shortens a string to the specified length with ellipsis

func Warning

func Warning(msg string)

Warning prints a yellow warning message: ⚠ message

func Warningf

func Warningf(format string, a ...interface{})

Warningf prints a yellow formatted warning message: ⚠ message

Types

type Format

type Format int

Format represents output format type

const (
	FormatTable Format = iota
	FormatJSON
	FormatQuiet
)

type Formatter

type Formatter interface {
	// Print outputs data to stdout
	Print(data interface{}) error

	// PrintTable outputs tabular data
	PrintTable(headers []string, rows [][]string) error

	// PrintSuccess prints a success message
	PrintSuccess(msg string)

	// PrintError prints an error message
	PrintError(msg string)

	// PrintWarning prints a warning message
	PrintWarning(msg string)

	// PrintInfo prints an info message
	PrintInfo(msg string)
}

Formatter interface for output formatting

func NewFormatter

func NewFormatter(format Format) Formatter

NewFormatter creates a formatter based on format type

type JSONFormatter

type JSONFormatter struct {
	Writer io.Writer
}

JSONFormatter outputs data as JSON

func (*JSONFormatter) Print

func (f *JSONFormatter) Print(data interface{}) error

func (*JSONFormatter) PrintError

func (f *JSONFormatter) PrintError(msg string)

func (*JSONFormatter) PrintInfo

func (f *JSONFormatter) PrintInfo(msg string)

func (*JSONFormatter) PrintSuccess

func (f *JSONFormatter) PrintSuccess(msg string)

func (*JSONFormatter) PrintTable

func (f *JSONFormatter) PrintTable(headers []string, rows [][]string) error

func (*JSONFormatter) PrintWarning

func (f *JSONFormatter) PrintWarning(msg string)

type QuietFormatter

type QuietFormatter struct {
	Writer io.Writer
}

QuietFormatter outputs minimal data (IDs only)

func (*QuietFormatter) Print

func (f *QuietFormatter) Print(data interface{}) error

func (*QuietFormatter) PrintError

func (f *QuietFormatter) PrintError(msg string)

func (*QuietFormatter) PrintInfo

func (f *QuietFormatter) PrintInfo(msg string)

func (*QuietFormatter) PrintSuccess

func (f *QuietFormatter) PrintSuccess(msg string)

func (*QuietFormatter) PrintTable

func (f *QuietFormatter) PrintTable(headers []string, rows [][]string) error

func (*QuietFormatter) PrintWarning

func (f *QuietFormatter) PrintWarning(msg string)

type TableFormatter

type TableFormatter struct {
	Writer io.Writer
}

TableFormatter outputs data as beautiful PTerm boxed tables

func (*TableFormatter) Print

func (f *TableFormatter) Print(data interface{}) error

func (*TableFormatter) PrintError

func (f *TableFormatter) PrintError(msg string)

func (*TableFormatter) PrintInfo

func (f *TableFormatter) PrintInfo(msg string)

func (*TableFormatter) PrintSuccess

func (f *TableFormatter) PrintSuccess(msg string)

func (*TableFormatter) PrintTable

func (f *TableFormatter) PrintTable(headers []string, rows [][]string) error

func (*TableFormatter) PrintWarning

func (f *TableFormatter) PrintWarning(msg string)

Jump to

Keyboard shortcuts

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