tui

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package tui provides the presentation layer for terminal output.

Index

Constants

View Source
const (
	Reset = "\033[0m"
	Bold  = "\033[1m"
	Dim   = "\033[2m"

	// Foreground colors
	Black   = "\033[30m"
	Red     = "\033[31m"
	Green   = "\033[32m"
	Yellow  = "\033[33m"
	Blue    = "\033[34m"
	Magenta = "\033[35m"
	Cyan    = "\033[36m"
	White   = "\033[37m"
	Gray    = "\033[90m"

	// Bright foreground colors
	BrightRed     = "\033[91m"
	BrightGreen   = "\033[92m"
	BrightYellow  = "\033[93m"
	BrightBlue    = "\033[94m"
	BrightMagenta = "\033[95m"
	BrightCyan    = "\033[96m"
	BrightWhite   = "\033[97m"

	// Bold variants
	BoldWhite = "\033[1;37m"
)

ANSI color codes

View Source
const (
	// DefaultTerminalWidth is used when terminal width cannot be detected.
	DefaultTerminalWidth = 80
	// MinTerminalWidth is the minimum width we'll use for rendering.
	MinTerminalWidth = 60
	// MaxTerminalWidth is the maximum width we'll use for rendering.
	MaxTerminalWidth = 200
)

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes formats bytes as a human-readable string.

func FormatCost added in v0.4.0

func FormatCost(cost float64) string

FormatCost formats a USD cost value (e.g., "$0.42", "$18.45").

func FormatDate

func FormatDate(t time.Time) string

FormatDate formats a date for display.

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration as a human-readable string.

func FormatExitCode

func FormatExitCode(code int) string

FormatExitCode formats an exit code.

func FormatLineChanges

func FormatLineChanges(added, removed int) string

FormatLineChanges formats line changes as "+N -M".

func FormatNumber

func FormatNumber(n int) string

FormatNumber formats a number with thousand separators.

func FormatNumber64 added in v0.4.0

func FormatNumber64(n int64) string

FormatNumber64 formats an int64 with thousand separators.

func FormatShortID

func FormatShortID(id string) string

FormatShortID returns the first 8 characters of an ID.

func FormatTime

func FormatTime(t time.Time) string

FormatTime formats a time for display.

func FormatTimeShort

func FormatTimeShort(t time.Time) string

FormatTimeShort formats a time as "Jan 2 15:04:05".

func FormatTokens added in v0.4.0

func FormatTokens(n int64) string

FormatTokens formats a token count as a human-readable string (e.g., "125.4K", "2.1M").

func GetTerminalWidth

func GetTerminalWidth() int

GetTerminalWidth returns the current terminal width. Falls back to DefaultTerminalWidth if detection fails or output is not a TTY.

func HorizontalLine

func HorizontalLine(width int) string

HorizontalLine returns a horizontal line of the given width.

func IsTerminal

func IsTerminal() bool

IsTerminal returns true if stdout is a terminal.

func IsWriterTerminal added in v0.3.2

func IsWriterTerminal(w io.Writer) bool

IsWriterTerminal returns true if w is backed by a terminal file descriptor.

func PadLeft

func PadLeft(s string, width int) string

PadLeft pads a string to the left to achieve the given width.

func PadRight

func PadRight(s string, width int) string

PadRight pads a string to the right to achieve the given width.

func PadRightVisible

func PadRightVisible(s string, width int) string

func RunWithSpinner added in v0.2.2

func RunWithSpinner[T any](message string, fn func() (T, error), opts ...SpinnerOption) (T, error)

func TreeContinue

func TreeContinue(hasMore bool) string

TreeContinue returns the tree continuation prefix.

func TreePrefix

func TreePrefix(isLast bool) string

TreePrefix returns the tree prefix for a list item.

func TruncateString

func TruncateString(s string, maxLen int) string

TruncateString truncates a string to the given length.

func VisibleLen

func VisibleLen(s string) int

Types

type AgentInstallView

type AgentInstallView struct {
	Name           string
	DisplayName    string
	Installed      bool
	Version        string
	Path           string
	HooksInstalled []string
	Warnings       []string
	Error          string
}

AgentInstallView represents an agent's installation result.

type AgentStatusView

type AgentStatusView struct {
	Name        string
	DisplayName string
	Installed   bool
	Version     string
	HooksCount  int
	HooksActive bool
}

AgentStatusView represents an agent's status.

type AgentUninstallView

type AgentUninstallView struct {
	Name            string
	DisplayName     string
	HooksRemoved    []string
	BackupsRestored bool
	Error           string
}

AgentUninstallView represents an agent's uninstallation result.

type CSVPresenter

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

CSVPresenter renders output as CSV.

func NewCSVPresenter

func NewCSVPresenter(opts PresenterOptions) *CSVPresenter

NewCSVPresenter creates a new CSV presenter.

func (*CSVPresenter) RenderConfig

func (p *CSVPresenter) RenderConfig(config *ConfigView) error

RenderConfig renders the configuration as CSV.

func (*CSVPresenter) RenderCostSummary added in v0.4.0

func (p *CSVPresenter) RenderCostSummary(summary *CostSummaryView) error

RenderCostSummary renders the cost summary as CSV.

func (*CSVPresenter) RenderDiff

func (p *CSVPresenter) RenderDiff(diff *DiffView) error

RenderDiff renders a diff view as CSV (content as single field).

func (*CSVPresenter) RenderDoctor

func (p *CSVPresenter) RenderDoctor(result *DoctorView) error

RenderDoctor renders the doctor check results as CSV.

func (*CSVPresenter) RenderError

func (p *CSVPresenter) RenderError(err error) error

RenderError renders an error message as CSV.

func (*CSVPresenter) RenderEventDetails added in v0.3.5

func (p *CSVPresenter) RenderEventDetails(events []*EventDetailView) error

RenderEventDetails renders full details of one or more events as CSV.

func (*CSVPresenter) RenderEvents

func (p *CSVPresenter) RenderEvents(events []*EventView) error

RenderEvents renders a list of events as CSV.

func (*CSVPresenter) RenderInstall

func (p *CSVPresenter) RenderInstall(result *InstallView) error

RenderInstall renders the installation result as CSV.

func (*CSVPresenter) RenderMessage

func (p *CSVPresenter) RenderMessage(message string) error

RenderMessage renders a simple message as CSV.

func (*CSVPresenter) RenderSelfAudits

func (p *CSVPresenter) RenderSelfAudits(entries []*SelfAuditView) error

RenderSelfAudits renders self-audit entries as CSV.

func (*CSVPresenter) RenderSession

func (p *CSVPresenter) RenderSession(session *SessionView, events []*EventView) error

RenderSession renders a single session detail as CSV.

func (*CSVPresenter) RenderSessions

func (p *CSVPresenter) RenderSessions(sessions []*SessionView) error

RenderSessions renders a list of sessions as CSV.

func (*CSVPresenter) RenderStatus

func (p *CSVPresenter) RenderStatus(status *StatusView) error

RenderStatus renders the tool status as CSV.

func (*CSVPresenter) RenderStreamSync added in v0.3.2

func (p *CSVPresenter) RenderStreamSync(result *StreamSyncView) error

RenderStreamSync renders stream sync results as CSV.

func (*CSVPresenter) RenderUninstall

func (p *CSVPresenter) RenderUninstall(result *UninstallView) error

RenderUninstall renders the uninstallation result as CSV.

func (*CSVPresenter) RenderUpdateNotice added in v0.3.2

func (p *CSVPresenter) RenderUpdateNotice(notice *UpdateNoticeView) error

RenderUpdateNotice renders an update availability notice as CSV.

type CheckStatus

type CheckStatus string

CheckStatus represents the status of a doctor check.

const (
	CheckOK   CheckStatus = "ok"
	CheckWarn CheckStatus = "warn"
	CheckFail CheckStatus = "fail"
)

type Colorizer

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

Colorizer wraps text with ANSI color codes if colors are enabled.

func NewColorizer

func NewColorizer(enabled bool) *Colorizer

NewColorizer creates a new Colorizer.

func (*Colorizer) Agent

func (c *Colorizer) Agent(text string) string

Agent formats an agent name.

func (*Colorizer) Apply

func (c *Colorizer) Apply(color, text string) string

Apply applies the given color to the text.

func (*Colorizer) Cyan

func (c *Colorizer) Cyan(text string) string

Cyan formats text in cyan color.

func (*Colorizer) DiffAdd

func (c *Colorizer) DiffAdd(text string) string

DiffAdd formats added lines in diff.

func (*Colorizer) DiffHeader

func (c *Colorizer) DiffHeader(text string) string

DiffHeader formats diff headers.

func (*Colorizer) DiffRemove

func (c *Colorizer) DiffRemove(text string) string

DiffRemove formats removed lines in diff.

func (*Colorizer) Dim

func (c *Colorizer) Dim(text string) string

Dim formats secondary/dim text.

func (*Colorizer) Error

func (c *Colorizer) Error(text string) string

Error formats error text.

func (*Colorizer) Header

func (c *Colorizer) Header(text string) string

Header formats text as a header.

func (*Colorizer) Number

func (c *Colorizer) Number(text string) string

Number formats numbers/stats.

func (*Colorizer) Path

func (c *Colorizer) Path(text string) string

Path formats a file path.

func (*Colorizer) StatusFail

func (c *Colorizer) StatusFail() string

StatusFail formats a fail status indicator.

func (*Colorizer) StatusOK

func (c *Colorizer) StatusOK() string

StatusOK formats an OK status indicator.

func (*Colorizer) StatusSkip

func (c *Colorizer) StatusSkip() string

StatusSkip formats a skip status indicator.

func (*Colorizer) Success

func (c *Colorizer) Success(text string) string

Success formats success text.

func (*Colorizer) Warning

func (c *Colorizer) Warning(text string) string

Warning formats warning text.

type ConfigStatusView

type ConfigStatusView struct {
	Location        string
	LoggingLevel    string
	RetentionDays   int
	EventsToClean   int       // Events that would be deleted by retention policy
	RetentionCutoff time.Time // The cutoff date for retention
}

ConfigStatusView represents configuration status.

type ConfigView

type ConfigView struct {
	Location string
	Values   map[string]interface{}
}

ConfigView represents configuration for display.

type CostGroupView added in v0.4.0

type CostGroupView struct {
	Label        string
	SessionCount int
	TotalTokens  int64
	InputTokens  int64
	OutputTokens int64
	CacheRead    int64
	CacheWrite   int64
	TotalCost    float64
}

CostGroupView represents an aggregated group in the cost summary.

type CostSessionView added in v0.4.0

type CostSessionView struct {
	ID          string
	ShortID     string
	AgentName   string
	ProjectName string
	StartedAt   time.Time
	ModelCount  int
	TotalTokens int64
	TotalCost   float64
	Models      []ModelUsageView
}

CostSessionView represents a session in the cost summary.

type CostSummaryView added in v0.4.0

type CostSummaryView struct {
	Sessions          []*CostSessionView
	TotalSessions     int
	TotalTokens       int64
	TotalInputTokens  int64
	TotalOutputTokens int64
	TotalCacheRead    int64
	TotalCacheWrite   int64
	TotalCost         float64
	GroupBy           string
	Groups            []CostGroupView
}

CostSummaryView represents the cost summary for display.

type DatabaseView

type DatabaseView struct {
	Location     string
	SizeBytes    int64
	SizeHuman    string
	EventCount   int
	SessionCount int
	OldestEvent  time.Time
	NewestEvent  time.Time
}

DatabaseView represents database information.

type DiffView

type DiffView struct {
	EventID   string
	SessionID string
	FilePath  string
	Timestamp time.Time
	Content   string
	Available bool
	Message   string
}

DiffView represents a diff for display.

type DoctorCheck

type DoctorCheck struct {
	Name        string
	Description string
	Status      CheckStatus
	Message     string
	Suggestion  string
}

DoctorCheck represents a single doctor check.

type DoctorView

type DoctorView struct {
	Checks []DoctorCheck
	AllOK  bool
}

DoctorView represents doctor check results.

type EventDetailView added in v0.3.5

type EventDetailView struct {
	ID               string          `json:"id"`
	SessionID        string          `json:"session_id"`
	AgentSessionID   string          `json:"agent_session_id,omitempty"`
	Sequence         int             `json:"sequence"`
	Timestamp        time.Time       `json:"timestamp"`
	DurationMs       int64           `json:"duration_ms,omitempty"`
	AgentName        string          `json:"agent_name"`
	AgentDisplayName string          `json:"agent_display_name"`
	AgentVersion     string          `json:"agent_version,omitempty"`
	WorkingDirectory string          `json:"working_directory,omitempty"`
	ActionType       string          `json:"action_type"`
	ActionDisplay    string          `json:"action_display"`
	ToolName         string          `json:"tool_name,omitempty"`
	ResultStatus     string          `json:"result_status"`
	ErrorMessage     string          `json:"error_message,omitempty"`
	IsSensitive      bool            `json:"is_sensitive"`
	Payload          any             `json:"payload,omitempty"`
	DiffContent      string          `json:"diff_content,omitempty"`
	RawEvent         json.RawMessage `json:"raw_event,omitempty"`
	ConvContext      string          `json:"conversation_context,omitempty"`
}

EventDetailView represents the full details of a single event.

type EventView

type EventView struct {
	ID               string
	ShortID          string
	SessionID        string
	ShortSessionID   string
	Sequence         int
	Timestamp        time.Time
	AgentName        string
	AgentDisplayName string
	ActionType       string
	ActionDisplay    string
	ToolName         string
	ResultStatus     string
	ErrorMessage     string
	Path             string
	Command          string
	LinesAdded       int
	LinesRemoved     int
	ExitCode         int
	DurationMs       int64
	IsSensitive      bool
	HasDiff          bool
}

EventView represents an event for display.

type Format

type Format string

Format represents the output format.

const (
	// FormatTable is the default table format.
	FormatTable Format = "table"
	// FormatJSON is JSON format.
	FormatJSON Format = "json"
	// FormatJSONL is newline-delimited JSON format.
	FormatJSONL Format = "jsonl"
	// FormatCSV is CSV format.
	FormatCSV Format = "csv"
)

type InstallView

type InstallView struct {
	Agents   []AgentInstallView
	Database string
	Config   string
}

InstallView represents installation results.

type JSONLPresenter

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

JSONLPresenter renders output as newline-delimited JSON.

func NewJSONLPresenter

func NewJSONLPresenter(opts PresenterOptions) *JSONLPresenter

NewJSONLPresenter creates a new JSONL presenter.

func (*JSONLPresenter) RenderConfig

func (p *JSONLPresenter) RenderConfig(config *ConfigView) error

RenderConfig renders the configuration as JSONL.

func (*JSONLPresenter) RenderCostSummary added in v0.4.0

func (p *JSONLPresenter) RenderCostSummary(summary *CostSummaryView) error

RenderCostSummary renders the cost summary as JSONL.

func (*JSONLPresenter) RenderDiff

func (p *JSONLPresenter) RenderDiff(diff *DiffView) error

RenderDiff renders a diff view as JSONL.

func (*JSONLPresenter) RenderDoctor

func (p *JSONLPresenter) RenderDoctor(result *DoctorView) error

RenderDoctor renders the doctor check results as JSONL.

func (*JSONLPresenter) RenderError

func (p *JSONLPresenter) RenderError(err error) error

RenderError renders an error message as JSONL.

func (*JSONLPresenter) RenderEventDetails added in v0.3.5

func (p *JSONLPresenter) RenderEventDetails(events []*EventDetailView) error

RenderEventDetails renders full details of one or more events as JSONL.

func (*JSONLPresenter) RenderEvents

func (p *JSONLPresenter) RenderEvents(events []*EventView) error

RenderEvents renders a list of events as JSONL (one per line).

func (*JSONLPresenter) RenderInstall

func (p *JSONLPresenter) RenderInstall(result *InstallView) error

RenderInstall renders the installation result as JSONL.

func (*JSONLPresenter) RenderMessage

func (p *JSONLPresenter) RenderMessage(message string) error

RenderMessage renders a simple message as JSONL.

func (*JSONLPresenter) RenderSelfAudits

func (p *JSONLPresenter) RenderSelfAudits(entries []*SelfAuditView) error

RenderSelfAudits renders self-audit entries as JSONL (one per line).

func (*JSONLPresenter) RenderSession

func (p *JSONLPresenter) RenderSession(session *SessionView, events []*EventView) error

RenderSession renders a single session detail as JSONL.

func (*JSONLPresenter) RenderSessions

func (p *JSONLPresenter) RenderSessions(sessions []*SessionView) error

RenderSessions renders a list of sessions as JSONL (one per line).

func (*JSONLPresenter) RenderStatus

func (p *JSONLPresenter) RenderStatus(status *StatusView) error

RenderStatus renders the tool status as JSONL.

func (*JSONLPresenter) RenderStreamSync added in v0.3.2

func (p *JSONLPresenter) RenderStreamSync(result *StreamSyncView) error

RenderStreamSync renders stream sync results as JSONL (one per line).

func (*JSONLPresenter) RenderUninstall

func (p *JSONLPresenter) RenderUninstall(result *UninstallView) error

RenderUninstall renders the uninstallation result as JSONL.

func (*JSONLPresenter) RenderUpdateNotice added in v0.3.2

func (p *JSONLPresenter) RenderUpdateNotice(notice *UpdateNoticeView) error

RenderUpdateNotice renders an update availability notice as JSONL.

type JSONPresenter

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

JSONPresenter renders output as JSON.

func NewJSONPresenter

func NewJSONPresenter(opts PresenterOptions) *JSONPresenter

NewJSONPresenter creates a new JSON presenter.

func (*JSONPresenter) RenderConfig

func (p *JSONPresenter) RenderConfig(config *ConfigView) error

RenderConfig renders the configuration as JSON.

func (*JSONPresenter) RenderCostSummary added in v0.4.0

func (p *JSONPresenter) RenderCostSummary(summary *CostSummaryView) error

RenderCostSummary renders the cost summary as JSON.

func (*JSONPresenter) RenderDiff

func (p *JSONPresenter) RenderDiff(diff *DiffView) error

RenderDiff renders a diff view as JSON.

func (*JSONPresenter) RenderDoctor

func (p *JSONPresenter) RenderDoctor(result *DoctorView) error

RenderDoctor renders the doctor check results as JSON.

func (*JSONPresenter) RenderError

func (p *JSONPresenter) RenderError(err error) error

RenderError renders an error message as JSON.

func (*JSONPresenter) RenderEventDetails added in v0.3.5

func (p *JSONPresenter) RenderEventDetails(events []*EventDetailView) error

RenderEventDetails renders full details of one or more events as JSON.

func (*JSONPresenter) RenderEvents

func (p *JSONPresenter) RenderEvents(events []*EventView) error

RenderEvents renders a list of events as JSON.

func (*JSONPresenter) RenderInstall

func (p *JSONPresenter) RenderInstall(result *InstallView) error

RenderInstall renders the installation result as JSON.

func (*JSONPresenter) RenderMessage

func (p *JSONPresenter) RenderMessage(message string) error

RenderMessage renders a simple message as JSON.

func (*JSONPresenter) RenderSelfAudits

func (p *JSONPresenter) RenderSelfAudits(entries []*SelfAuditView) error

RenderSelfAudits renders self-audit entries as JSON.

func (*JSONPresenter) RenderSession

func (p *JSONPresenter) RenderSession(session *SessionView, events []*EventView) error

RenderSession renders a single session detail as JSON.

func (*JSONPresenter) RenderSessions

func (p *JSONPresenter) RenderSessions(sessions []*SessionView) error

RenderSessions renders a list of sessions as JSON.

func (*JSONPresenter) RenderStatus

func (p *JSONPresenter) RenderStatus(status *StatusView) error

RenderStatus renders the tool status as JSON.

func (*JSONPresenter) RenderStreamSync added in v0.3.2

func (p *JSONPresenter) RenderStreamSync(result *StreamSyncView) error

RenderStreamSync renders stream sync results as JSON.

func (*JSONPresenter) RenderUninstall

func (p *JSONPresenter) RenderUninstall(result *UninstallView) error

RenderUninstall renders the uninstallation result as JSON.

func (*JSONPresenter) RenderUpdateNotice added in v0.3.2

func (p *JSONPresenter) RenderUpdateNotice(notice *UpdateNoticeView) error

RenderUpdateNotice renders an update availability notice as JSON.

type ModelUsageView added in v0.4.0

type ModelUsageView struct {
	Model            string
	InputTokens      int64
	OutputTokens     int64
	CacheReadTokens  int64
	CacheWriteTokens int64
	Cost             float64
}

ModelUsageView represents per-model token usage for display.

type Presenter

type Presenter interface {
	// RenderStatus renders the tool status.
	RenderStatus(status *StatusView) error

	// RenderSessions renders a list of sessions.
	RenderSessions(sessions []*SessionView) error

	// RenderSession renders a single session detail.
	RenderSession(session *SessionView, events []*EventView) error

	// RenderEvents renders a list of events.
	RenderEvents(events []*EventView) error

	// RenderEventDetails renders full details of one or more events.
	RenderEventDetails(events []*EventDetailView) error

	// RenderInstall renders the installation result.
	RenderInstall(result *InstallView) error

	// RenderUninstall renders the uninstallation result.
	RenderUninstall(result *UninstallView) error

	// RenderDoctor renders the doctor check results.
	RenderDoctor(result *DoctorView) error

	// RenderConfig renders the configuration.
	RenderConfig(config *ConfigView) error

	// RenderSelfAudits renders self-audit entries.
	RenderSelfAudits(entries []*SelfAuditView) error

	// RenderDiff renders a diff view.
	RenderDiff(diff *DiffView) error

	// RenderError renders an error message.
	RenderError(err error) error

	// RenderMessage renders a simple message.
	RenderMessage(message string) error

	// RenderStreamSync renders stream sync results.
	RenderStreamSync(result *StreamSyncView) error

	// RenderUpdateNotice renders an update availability notice.
	RenderUpdateNotice(notice *UpdateNoticeView) error

	// RenderCostSummary renders the cost summary.
	RenderCostSummary(summary *CostSummaryView) error
}

Presenter defines the interface for output rendering.

func DefaultPresenter

func DefaultPresenter() Presenter

DefaultPresenter returns a presenter with default options.

func NewPresenter

func NewPresenter(format Format, opts PresenterOptions) Presenter

NewPresenter creates a new presenter for the given format.

type PresenterOptions

type PresenterOptions struct {
	// Writer is the output destination.
	Writer io.Writer
	// UseColors indicates if colors should be used.
	UseColors bool
	// Verbose increases output verbosity.
	Verbose bool
	// TerminalWidth is the width of the terminal for table rendering.
	// If 0, the width will be auto-detected.
	TerminalWidth int
}

PresenterOptions configures presenter behavior.

type ProgressWriter added in v0.3.2

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

ProgressWriter writes progress updates to a single terminal line.

func NewProgressWriter added in v0.3.2

func NewProgressWriter(w io.Writer, useColors bool) *ProgressWriter

NewProgressWriter creates a new ProgressWriter.

func (*ProgressWriter) Clear added in v0.3.2

func (p *ProgressWriter) Clear()

Clear clears the progress line.

func (*ProgressWriter) Update added in v0.3.2

func (p *ProgressWriter) Update(format string, args ...any)

Update clears the line and writes new progress text.

type SelfAuditView

type SelfAuditView struct {
	ID           string
	Timestamp    time.Time
	Action       string
	AgentName    string
	Result       string
	ErrorMessage string
	ToolVersion  string
	Details      map[string]interface{}
}

SelfAuditView represents a self-audit entry for display.

type SessionView

type SessionView struct {
	ID               string
	ShortID          string
	AgentName        string
	AgentDisplayName string
	AgentVersion     string
	StartedAt        time.Time
	EndedAt          time.Time
	Duration         time.Duration
	WorkingDirectory string
	ProjectName      string
	TotalActions     int
	FilesRead        int
	FilesWritten     int
	CommandsExecuted int
	Errors           int
	LinesAdded       int
	LinesRemoved     int
	InputTokens      int64
	OutputTokens     int64
	CacheReadTokens  int64
	CacheWriteTokens int64
	EstimatedCostUSD float64
	ModelUsage       []ModelUsageView
	CostSource       string
	CostComputedAt   *time.Time
}

SessionView represents a session for display.

type SpinnerOption added in v0.2.2

type SpinnerOption func(*spinnerWriter)

func WithInterval added in v0.2.2

func WithInterval(d time.Duration) SpinnerOption

func WithWriter added in v0.2.2

func WithWriter(w io.Writer) SpinnerOption

type StatusView

type StatusView struct {
	Version  string
	Agents   []AgentStatusView
	Database DatabaseView
	Config   ConfigStatusView
}

StatusView represents the status output data.

type StreamSyncView added in v0.3.2

type StreamSyncView struct {
	TargetResults []StreamTargetResultView
	TotalEvents   int
	TotalAudits   int
	HasErrors     bool
}

StreamSyncView represents stream sync results for display.

type StreamTargetResultView added in v0.3.2

type StreamTargetResultView struct {
	TargetName string
	EventsSent int
	AuditsSent int
	Error      string
}

StreamTargetResultView represents a single target's sync result.

type TablePresenter

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

TablePresenter renders output in table format.

func NewTablePresenter

func NewTablePresenter(opts PresenterOptions) *TablePresenter

NewTablePresenter creates a new table presenter.

func (*TablePresenter) RenderConfig

func (p *TablePresenter) RenderConfig(config *ConfigView) error

RenderConfig renders the configuration.

func (*TablePresenter) RenderCostSummary added in v0.4.0

func (p *TablePresenter) RenderCostSummary(summary *CostSummaryView) error

RenderCostSummary renders the cost summary.

func (*TablePresenter) RenderDiff

func (p *TablePresenter) RenderDiff(diff *DiffView) error

RenderDiff renders a diff view.

func (*TablePresenter) RenderDoctor

func (p *TablePresenter) RenderDoctor(result *DoctorView) error

RenderDoctor renders the doctor check results.

func (*TablePresenter) RenderError

func (p *TablePresenter) RenderError(err error) error

RenderError renders an error message.

func (*TablePresenter) RenderEventDetails added in v0.3.5

func (p *TablePresenter) RenderEventDetails(events []*EventDetailView) error

RenderEventDetails renders full details of one or more events.

func (*TablePresenter) RenderEvents

func (p *TablePresenter) RenderEvents(events []*EventView) error

RenderEvents renders a list of events.

func (*TablePresenter) RenderInstall

func (p *TablePresenter) RenderInstall(result *InstallView) error

RenderInstall renders the installation result.

func (*TablePresenter) RenderMessage

func (p *TablePresenter) RenderMessage(message string) error

RenderMessage renders a simple message.

func (*TablePresenter) RenderSelfAudits

func (p *TablePresenter) RenderSelfAudits(entries []*SelfAuditView) error

RenderSelfAudits renders self-audit entries.

func (*TablePresenter) RenderSession

func (p *TablePresenter) RenderSession(session *SessionView, events []*EventView) error

RenderSession renders a single session detail.

func (*TablePresenter) RenderSessions

func (p *TablePresenter) RenderSessions(sessions []*SessionView) error

RenderSessions renders a list of sessions.

func (*TablePresenter) RenderStatus

func (p *TablePresenter) RenderStatus(status *StatusView) error

RenderStatus renders the tool status.

func (*TablePresenter) RenderStreamSync added in v0.3.2

func (p *TablePresenter) RenderStreamSync(result *StreamSyncView) error

RenderStreamSync renders stream sync results.

func (*TablePresenter) RenderUninstall

func (p *TablePresenter) RenderUninstall(result *UninstallView) error

RenderUninstall renders the uninstallation result.

func (*TablePresenter) RenderUpdateNotice added in v0.3.2

func (p *TablePresenter) RenderUpdateNotice(notice *UpdateNoticeView) error

RenderUpdateNotice renders an update availability notice.

type UninstallView

type UninstallView struct {
	Agents []AgentUninstallView
	Purged bool
}

UninstallView represents uninstallation results.

type UpdateNoticeView added in v0.3.2

type UpdateNoticeView struct {
	CurrentVersion string `json:"current_version"`
	LatestVersion  string `json:"latest_version"`
	ReleaseURL     string `json:"release_url"`
}

UpdateNoticeView represents an available update for display.

Directories

Path Synopsis
component

Jump to

Keyboard shortcuts

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