output

package
v0.2.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands. Task stackeye-5859.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands. Task #8065

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers that bridge the CLI's global flags with the SDK's output formatters.

This package simplifies command output by providing convenience functions that automatically respect the user's --output and --no-color preferences.

Usage:

// In a command's RunE function:
data, err := api.ListProbes(ctx)
if err != nil {
    return output.PrintError(err)
}
if len(data) == 0 {
    output.PrintEmpty("No probes found")
    return nil
}
return output.Print(data)

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers for StackEye commands.

Package output provides CLI output helpers that bridge the CLI's global flags with the SDK's output formatters.

Package output provides CLI output helpers.

Index

Constants

This section is empty.

Variables

View Source
var ASCIISpinnerFrames = []string{"|", "/", "-", "\\"}

ASCIISpinnerFrames provides an ASCII-only spinner for terminals without Unicode.

View Source
var DefaultSpinnerFrames = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}

DefaultSpinnerFrames provides a simple ASCII spinner animation.

Functions

func FormatIncidentCount

func FormatIncidentCount(total int64, page, limit int) string

FormatIncidentCount formats the total count for pagination display.

func FormatStatusPageCount

func FormatStatusPageCount(total int64, page, limit int) string

FormatStatusPageCount formats the total count for pagination display.

func IsDumbTerminal

func IsDumbTerminal() bool

IsDumbTerminal returns true if the TERM environment variable is set to "dumb", indicating a terminal that does not support ANSI escape sequences. Colors and animations should be disabled for dumb terminals.

func IsInteractive

func IsInteractive() bool

IsInteractive returns true if the CLI is running in an interactive context where colors, spinners, prompts, and other interactive features are appropriate. It checks (in order):

  1. stdout is a TTY (not piped/redirected)
  2. TERM is not "dumb"
  3. --no-input flag is not set
  4. STACKEYE_NO_INPUT environment variable is not set

When IsInteractive returns false, commands should:

  • Disable colors (unless --color=always)
  • Disable spinners and progress bars
  • Skip interactive prompts (use defaults or error)
  • Use machine-readable output when appropriate

func IsPiped

func IsPiped() bool

IsPiped returns true if stdout is not a terminal (i.e., output is being piped or redirected to a file). When piped, commands should prefer machine-readable output and disable colors.

func IsStderrPiped

func IsStderrPiped() bool

IsStderrPiped returns true if stderr is not a terminal. When stderr is piped, interactive elements like spinners and progress bars should be disabled since they use ANSI escape sequences that corrupt piped output.

func MaskSensitive

func MaskSensitive(val string) string

MaskSensitive masks a sensitive value, showing only the prefix and last 4 chars. For API keys with format "se_<hex>", shows "se_****...xxxx". For short values (<=8 chars), shows "****".

func NewColorManager

func NewColorManager() *sdkoutput.ColorManager

NewColorManager creates a ColorManager from the current CLI configuration. It respects the user's color preference from config, --no-color flag, NO_COLOR environment variable, and TERM=dumb detection (via the SDK).

If no config getter is set or config is nil, returns a ColorManager in auto mode (colors enabled when stdout is a terminal).

NO_COLOR Handling (Intentional Duplication)

The NO_COLOR environment variable (https://no-color.org/) is checked in two places by design:

  1. CLI layer (cmd/root.go initConfig): Checks NO_COLOR early during config initialization and sets ColorModeNever on the config preferences. This ensures the CLI's --no-color flag and NO_COLOR env var are handled consistently at the config level before any output is produced.

  2. SDK layer (stackeye-go-sdk/output/color.go NewColorManager): Checks NO_COLOR in ColorAuto mode as a safety net. This ensures any direct SDK consumer (not just the CLI) also respects the NO_COLOR convention.

This separation of concerns means the SDK works correctly standalone (e.g., in third-party tools using the Go SDK) without depending on CLI config initialization. The CLI's early check converts NO_COLOR into a config preference (ColorModeNever), which then propagates through NewColorManager as an explicit mode rather than relying on the SDK's auto-detection.

func NewColorManagerFromConfig

func NewColorManagerFromConfig(cfg *config.Config) *sdkoutput.ColorManager

NewColorManagerFromConfig creates a ColorManager from an explicit config. This is useful in commands that need a ColorManager before the global config getter is available.

func Print

func Print(data any) error

Print formats and outputs data using the CLI's configured format. This is a convenience function that uses the global configuration.

Example:

probes, err := client.ListProbes(ctx)
if err != nil {
    return err
}
return output.Print(probes)

func PrintAPIKey

func PrintAPIKey(key client.APIKey) error

PrintAPIKey is a convenience function that formats and prints a single API key.

func PrintAPIKeys

func PrintAPIKeys(keys []client.APIKey) error

PrintAPIKeys is a convenience function that formats and prints API keys using the CLI's configured output format. It handles wide mode automatically based on configuration.

func PrintAggregatedStatus

func PrintAggregatedStatus(status client.AggregatedStatusResponse) error

PrintAggregatedStatus prints the aggregated status of a status page. It displays the overall status header and a table of probe statuses.

func PrintAlert

func PrintAlert(alert client.Alert) error

PrintAlert is a convenience function that formats and prints a single alert.

func PrintAlertStats

func PrintAlertStats(stats *client.AlertStats) error

PrintAlertStats is a convenience function that formats and prints alert statistics using the CLI's configured output format. It handles severity coloring automatically based on configuration.

func PrintAlerts

func PrintAlerts(alerts []client.Alert) error

PrintAlerts is a convenience function that formats and prints alerts using the CLI's configured output format. It handles severity/status coloring and wide mode automatically based on configuration.

func PrintChannel

func PrintChannel(channel client.Channel) error

PrintChannel is a convenience function that formats and prints a single channel.

func PrintChannels

func PrintChannels(channels []client.Channel) error

PrintChannels is a convenience function that formats and prints channels using the CLI's configured output format. It handles status coloring and wide mode automatically based on configuration.

func PrintDeviceRegions

func PrintDeviceRegions(regions []client.DeviceRegion) error

PrintDeviceRegions is a convenience function that formats and prints device region assignments. Task stackeye-5859.

func PrintDeviceTags

func PrintDeviceTags(tags []client.DeviceTag) error

PrintDeviceTags is a convenience function that formats and prints device tags. Task stackeye-5859.

func PrintDomainVerification

func PrintDomainVerification(verification client.DomainVerificationResponse) error

PrintDomainVerification prints the DNS verification record for a custom domain. It displays the host (TXT record name) and value to configure in DNS.

func PrintEmpty

func PrintEmpty(message string) error

PrintEmpty outputs a user-friendly message for empty results. This is a convenience function that uses the global configuration.

Example:

probes, err := client.ListProbes(ctx)
if err != nil {
    return err
}
if len(probes) == 0 {
    output.PrintEmpty("No probes found. Create one with 'stackeye probe create'")
    return nil
}
return output.Print(probes)

func PrintEnrollmentKeys

func PrintEnrollmentKeys(keys []client.EnrollmentKey) error

PrintEnrollmentKeys is a convenience function that formats and prints enrollment keys using the CLI's configured output format. It handles wide mode automatically based on configuration.

func PrintEnvVars

func PrintEnvVars(rows []EnvVarRow) error

PrintEnvVars formats and prints environment variables using the CLI's configured output format.

func PrintEnvVarsWithFormat

func PrintEnvVarsWithFormat(rows []EnvVarRow, format string) error

PrintEnvVarsWithFormat formats and prints environment variables using the specified output format string. This is used by commands that skip config loading and need to respect the --output flag directly.

func PrintError

func PrintError(err error) error

PrintError formats and outputs an error message. This is a convenience function that uses the global configuration.

Example:

if err := client.DeleteProbe(ctx, id); err != nil {
    return output.PrintError(err)
}

func PrintIfNotEmpty

func PrintIfNotEmpty(data any, emptyMessage string) error

PrintIfNotEmpty is a convenience function that handles the common pattern of printing data if it exists, or an empty message if not.

Example:

probes, err := client.ListProbes(ctx)
if err != nil {
    return err
}
return output.PrintIfNotEmpty(probes, "No probes found")

func PrintIncident

func PrintIncident(incident client.Incident) error

PrintIncident is a convenience function that formats and prints a single incident.

func PrintIncidentDetail

func PrintIncidentDetail(incident client.Incident) error

PrintIncidentDetail prints a single incident in detailed format. This shows the full message and timeline information.

func PrintIncidents

func PrintIncidents(incidents []client.Incident) error

PrintIncidents is a convenience function that formats and prints incidents using the CLI's configured output format. It handles status coloring and wide mode automatically based on configuration.

func PrintInvitation

func PrintInvitation(invitation *client.Invitation) error

PrintInvitation is a convenience function that formats and prints a single invitation.

func PrintInvitationCreated

func PrintInvitationCreated(invitation *client.Invitation) error

PrintInvitationCreated prints a success message after creating an invitation. For JSON/YAML formats, it outputs the full invitation object. For table format, it prints a human-friendly success message.

func PrintInvitationRevoked

func PrintInvitationRevoked(invitationID, email string) error

PrintInvitationRevoked prints a success message after revoking an invitation. For JSON/YAML formats, it outputs a structured response object. For table format, it prints a human-friendly success message.

func PrintInvitations

func PrintInvitations(invitations []client.Invitation) error

PrintInvitations is a convenience function that formats and prints invitations using the CLI's configured output format. It handles coloring and wide mode automatically based on configuration.

func PrintInvoice

func PrintInvoice(invoice client.Invoice) error

PrintInvoice is a convenience function that formats and prints a single invoice.

func PrintInvoices

func PrintInvoices(invoices []client.Invoice) error

PrintInvoices is a convenience function that formats and prints invoices using the CLI's configured output format.

func PrintLabelKey

func PrintLabelKey(labelKey client.LabelKey) error

PrintLabelKey is a convenience function that formats and prints a single label key.

func PrintLabelKeys

func PrintLabelKeys(labelKeys []client.LabelKey) error

PrintLabelKeys is a convenience function that formats and prints label keys using the CLI's configured output format.

func PrintMemberRemoved

func PrintMemberRemoved(memberID uint, email string) error

PrintMemberRemoved prints a success message after removing a team member. For JSON/YAML formats, it outputs a structured response object. For table format, it prints a human-friendly success message.

func PrintMute

func PrintMute(mute client.AlertMute) error

PrintMute is a convenience function that formats and prints a single mute.

func PrintMutes

func PrintMutes(mutes []client.AlertMute) error

PrintMutes is a convenience function that formats and prints mutes using the CLI's configured output format. It handles status coloring and wide mode automatically based on configuration.

func PrintOrganization

func PrintOrganization(org client.Organization) error

PrintOrganization is a convenience function that formats and prints a single organization.

func PrintOrganizations

func PrintOrganizations(orgs []client.Organization) error

PrintOrganizations is a convenience function that formats and prints organizations using the CLI's configured output format. It handles status coloring and wide mode automatically based on configuration.

func PrintProbe

func PrintProbe(probe client.Probe) error

PrintProbe is a convenience function that formats and prints a single probe.

func PrintProbeLabels

func PrintProbeLabels(labels []client.ProbeLabel) error

PrintProbeLabels is a convenience function that formats and prints probe labels. Task #8068

func PrintProbes

func PrintProbes(probes []client.Probe) error

PrintProbes is a convenience function that formats and prints probes using the CLI's configured output format. It handles status coloring and wide mode automatically based on configuration.

func PrintRegionStatus

func PrintRegionStatus(status client.RegionStatus) error

PrintRegionStatus is a convenience function for printing a single region status.

func PrintRegionStatuses

func PrintRegionStatuses(statuses []client.RegionStatus) error

PrintRegionStatuses is a convenience function that formats and prints region statuses using the CLI's configured output format. It handles wide mode automatically.

func PrintRegions

func PrintRegions(regionsByContinent map[string][]client.Region) error

PrintRegions is a convenience function that formats and prints regions using the CLI's configured output format. It handles wide mode automatically.

func PrintRegionsFlat

func PrintRegionsFlat(regions []client.Region) error

PrintRegionsFlat is a convenience function for printing a flat list of regions.

func PrintRoleUpdated

func PrintRoleUpdated(result *client.UpdateMemberRoleResponse) error

PrintRoleUpdated prints a success message after updating a member's role. For JSON/YAML formats, it outputs the full response object. For table format, it prints a human-friendly success message.

func PrintStatusPage

func PrintStatusPage(page client.StatusPage) error

PrintStatusPage is a convenience function that formats and prints a single status page. For JSON/YAML output, it prints the raw StatusPage object including all probe details. For table output, it formats the data into a human-readable row.

func PrintStatusPages

func PrintStatusPages(pages []client.StatusPage) error

PrintStatusPages is a convenience function that formats and prints status pages using the CLI's configured output format. It handles status coloring and wide mode automatically based on configuration. For JSON/YAML output, it prints the raw StatusPage objects including all probe details. For table output, it formats the data into human-readable rows.

func PrintSubscription

func PrintSubscription(info *client.BillingInfo) error

PrintSubscription is a convenience function that formats and prints billing info using the CLI's configured output format.

func PrintTeamMember

func PrintTeamMember(member client.TeamMember) error

PrintTeamMember is a convenience function that formats and prints a single team member.

func PrintTeamMembers

func PrintTeamMembers(members []client.TeamMember) error

PrintTeamMembers is a convenience function that formats and prints team members using the CLI's configured output format. It handles coloring and wide mode automatically based on configuration.

func PrintUsage

func PrintUsage(usage *client.UsageInfo) error

PrintUsage is a convenience function that formats and prints usage info using the CLI's configured output format.

func RunWithProgressBar

func RunWithProgressBar(total int, message string, fn func(bar *ProgressBar) error) error

RunWithProgressBar executes a function that processes items, displaying a progress bar. The callback receives the bar to call Increment() on each item.

Example:

err := output.RunWithProgressBar(len(probes), "Pausing probes...", func(bar *ProgressBar) error {
    for _, probe := range probes {
        if err := client.PauseProbe(ctx, probe.ID); err != nil {
            return err
        }
        bar.Increment()
    }
    return nil
})

func RunWithSpinner

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

RunWithSpinner executes a function while displaying a spinner. The spinner is automatically stopped when the function completes.

Example:

result, err := output.RunWithSpinner("Loading probes...", func() (any, error) {
    return client.ListProbes(ctx)
})

func RunWithSpinnerCtx

func RunWithSpinnerCtx[T any](ctx context.Context, message string, fn func(context.Context) (T, error)) (T, error)

RunWithSpinnerCtx executes a function with context while displaying a spinner. The spinner is stopped when the function completes or the context is canceled.

func SetConfigGetter

func SetConfigGetter(getter func() *config.Config)

SetConfigGetter sets the function used to retrieve the current configuration. This should be called once during CLI initialization from the cmd package. The getter is stored atomically and safe for concurrent access.

func SetIsPipedOverride

func SetIsPipedOverride(fn func() bool)

SetIsPipedOverride sets a function that overrides IsPiped's OS detection. Pass nil to restore default behaviour. Intended for testing only. The override is stored atomically and safe for concurrent access.

func SetIsStderrPipedOverride

func SetIsStderrPipedOverride(fn func() bool)

SetIsStderrPipedOverride sets a function that overrides IsStderrPiped's OS detection. Pass nil to restore default behaviour. Intended for testing only. The override is stored atomically and safe for concurrent access.

func SetNoInputGetter

func SetNoInputGetter(getter func() bool)

SetNoInputGetter sets the function used to check if --no-input is active. This should be called once during CLI initialization from the cmd package. The getter is stored atomically and safe for concurrent access.

Types

type APIKeyTableFormatter

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

APIKeyTableFormatter converts SDK APIKey types to table-displayable rows.

func NewAPIKeyTableFormatter

func NewAPIKeyTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *APIKeyTableFormatter

NewAPIKeyTableFormatter creates a new formatter for API key table output. The colorMode parameter controls whether colors are applied. Set isWide to true for extended output with additional columns.

func (*APIKeyTableFormatter) FormatAPIKey

func (f *APIKeyTableFormatter) FormatAPIKey(key client.APIKey) APIKeyTableRow

FormatAPIKey converts a single SDK APIKey into a table-displayable row.

func (*APIKeyTableFormatter) FormatAPIKeys

func (f *APIKeyTableFormatter) FormatAPIKeys(keys []client.APIKey) []APIKeyTableRow

FormatAPIKeys converts a slice of SDK APIKeys into table-displayable rows.

type APIKeyTableRow

type APIKeyTableRow struct {
	Name        string `table:"NAME"`
	KeyPrefix   string `table:"PREFIX"`
	Permissions string `table:"PERMISSIONS"`
	LastUsed    string `table:"LAST USED"`
	// Wide mode columns
	Expires string `table:"EXPIRES,wide"`
	Created string `table:"CREATED,wide"`
	ID      string `table:"ID,wide"`
}

APIKeyTableRow represents a row in the API key table output. The struct tags control column headers and wide mode display.

type AggregatedStatusTableFormatter

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

AggregatedStatusTableFormatter converts SDK AggregatedStatusResponse to table rows with status coloring support.

func NewAggregatedStatusTableFormatter

func NewAggregatedStatusTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *AggregatedStatusTableFormatter

NewAggregatedStatusTableFormatter creates a new formatter for aggregated status output.

func (*AggregatedStatusTableFormatter) FormatProbeStatuses

FormatProbeStatuses converts a slice of SDK ProbeStatusSummary into table rows.

type AlertStatsFormatter

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

AlertStatsFormatter converts SDK AlertStats into table-displayable rows with severity coloring support for the by-severity breakdown.

func NewAlertStatsFormatter

func NewAlertStatsFormatter(colorMode sdkoutput.ColorMode) *AlertStatsFormatter

NewAlertStatsFormatter creates a new formatter for alert stats output. The colorMode parameter controls whether severity colors are applied.

func (*AlertStatsFormatter) FormatAlertStats

func (f *AlertStatsFormatter) FormatAlertStats(stats *client.AlertStats) []AlertStatsRow

FormatAlertStats converts SDK AlertStats into table-displayable rows. The output shows summary statistics followed by severity breakdown.

type AlertStatsRow

type AlertStatsRow struct {
	Metric string `table:"METRIC"`
	Value  string `table:"VALUE"`
}

AlertStatsRow represents a row in the alert stats table output. Each row shows a metric name and its value.

type AlertTableFormatter

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

AlertTableFormatter converts SDK Alert types to table-displayable rows with severity and status coloring support.

func NewAlertTableFormatter

func NewAlertTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *AlertTableFormatter

NewAlertTableFormatter creates a new formatter for alert table output. The colorMode parameter controls whether severity/status colors are applied. Set isWide to true for extended output with additional columns.

func (*AlertTableFormatter) FormatAlert

func (f *AlertTableFormatter) FormatAlert(alert client.Alert) AlertTableRow

FormatAlert converts a single SDK Alert into a table-displayable row.

func (*AlertTableFormatter) FormatAlerts

func (f *AlertTableFormatter) FormatAlerts(alerts []client.Alert) []AlertTableRow

FormatAlerts converts a slice of SDK Alerts into table-displayable rows. Severity fields are colored based on alert level:

  • critical: red
  • warning: yellow
  • info: cyan

Status fields are colored based on alert state:

  • active: red
  • acknowledged: yellow
  • resolved: green

type AlertTableRow

type AlertTableRow struct {
	Severity  string `table:"SEVERITY"`
	Status    string `table:"STATUS"`
	Type      string `table:"TYPE"`
	Probe     string `table:"PROBE"`
	Triggered string `table:"TRIGGERED"`
	Duration  string `table:"DURATION"`
	// Wide mode columns
	AckBy   string `table:"ACK BY,wide"`
	Message string `table:"MESSAGE,wide"`
	ID      string `table:"ID,wide"`
}

AlertTableRow represents a row in the alert table output. The struct tags control column headers and wide mode display.

type ChannelTableFormatter

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

ChannelTableFormatter converts SDK Channel types to table-displayable rows with status coloring support.

func NewChannelTableFormatter

func NewChannelTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *ChannelTableFormatter

NewChannelTableFormatter creates a new formatter for channel table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*ChannelTableFormatter) FormatChannel

func (f *ChannelTableFormatter) FormatChannel(channel client.Channel) ChannelTableRow

FormatChannel converts a single SDK Channel into a table-displayable row.

func (*ChannelTableFormatter) FormatChannels

func (f *ChannelTableFormatter) FormatChannels(channels []client.Channel) []ChannelTableRow

FormatChannels converts a slice of SDK Channels into table-displayable rows. Status fields are colored based on channel state:

  • enabled: green
  • disabled: red

type ChannelTableRow

type ChannelTableRow struct {
	Status string `table:"STATUS"`
	Name   string `table:"NAME"`
	Type   string `table:"TYPE"`
	Target string `table:"TARGET"`
	Probes string `table:"PROBES"`
	// Wide mode columns
	Created string `table:"CREATED,wide"`
	ID      string `table:"ID,wide"`
}

ChannelTableRow represents a row in the channel table output. The struct tags control column headers and wide mode display.

type DeviceRegionTableRow

type DeviceRegionTableRow struct {
	RegionID string `table:"REGION"`
}

DeviceRegionTableRow represents a row in the device region table output. Task stackeye-5859.

func FormatDeviceRegions

func FormatDeviceRegions(regions []client.DeviceRegion) []DeviceRegionTableRow

FormatDeviceRegions converts a slice of device region assignments into table-displayable rows. Task stackeye-5859.

type DeviceTagTableRow

type DeviceTagTableRow struct {
	Key   string `table:"KEY"`
	Value string `table:"VALUE"`
}

DeviceTagTableRow represents a row in the device tag table output. Task stackeye-5859.

func FormatDeviceTags

func FormatDeviceTags(tags []client.DeviceTag) []DeviceTagTableRow

FormatDeviceTags converts a slice of device tags into table-displayable rows. Task stackeye-5859.

type DomainVerificationTableRow

type DomainVerificationTableRow struct {
	Host  string `table:"HOST"`
	Value string `table:"VALUE"`
}

DomainVerificationTableRow represents a row in the domain verification table output. The struct tags control column headers.

type EnrollmentKeyTableFormatter

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

EnrollmentKeyTableFormatter converts SDK EnrollmentKey types to table-displayable rows.

func NewEnrollmentKeyTableFormatter

func NewEnrollmentKeyTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *EnrollmentKeyTableFormatter

NewEnrollmentKeyTableFormatter creates a new formatter for enrollment key table output.

func (*EnrollmentKeyTableFormatter) FormatEnrollmentKey

FormatEnrollmentKey converts a single SDK EnrollmentKey into a table-displayable row.

func (*EnrollmentKeyTableFormatter) FormatEnrollmentKeys

func (f *EnrollmentKeyTableFormatter) FormatEnrollmentKeys(keys []client.EnrollmentKey) []EnrollmentKeyTableRow

FormatEnrollmentKeys converts a slice of SDK EnrollmentKeys into table-displayable rows.

type EnrollmentKeyTableRow

type EnrollmentKeyTableRow struct {
	Name         string `table:"NAME"`
	KeyPrefix    string `table:"PREFIX"`
	Mode         string `table:"MODE"`
	Capabilities string `table:"CAPABILITIES"`
	Uses         string `table:"USES"`
	Expires      string `table:"EXPIRES"`
	// Wide mode columns
	Environment string `table:"ENVIRONMENT,wide"`
	Created     string `table:"CREATED,wide"`
	ID          string `table:"ID,wide"`
}

EnrollmentKeyTableRow represents a row in the enrollment key table output. The struct tags control column headers and wide mode display.

type EnvVarDefinition

type EnvVarDefinition struct {
	Name        string
	Description string
	Sensitive   bool
}

EnvVarDefinition defines a supported environment variable.

func SupportedEnvVars

func SupportedEnvVars() []EnvVarDefinition

SupportedEnvVars returns all environment variables that affect CLI behavior.

type EnvVarRow

type EnvVarRow struct {
	Variable    string `json:"variable" yaml:"variable" table:"VARIABLE"`
	Value       string `json:"value" yaml:"value" table:"VALUE"`
	Source      string `json:"source" yaml:"source" table:"SOURCE"`
	Description string `json:"description" yaml:"description" table:"DESCRIPTION,wide"`
}

EnvVarRow represents a row in the environment variable table output.

func CollectEnvVars

func CollectEnvVars() []EnvVarRow

CollectEnvVars builds table rows for all supported environment variables.

type IncidentDetail

type IncidentDetail struct {
	ID         string
	Title      string
	Status     string
	Impact     string
	Message    string
	CreatedAt  string
	UpdatedAt  string
	ResolvedAt string
	Duration   string
}

IncidentDetail represents a detailed view of a single incident. Used for displaying full incident information including the message body.

type IncidentTableFormatter

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

IncidentTableFormatter converts SDK Incident types to table-displayable rows with status coloring support.

func NewIncidentTableFormatter

func NewIncidentTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *IncidentTableFormatter

NewIncidentTableFormatter creates a new formatter for incident table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*IncidentTableFormatter) FormatIncident

func (f *IncidentTableFormatter) FormatIncident(incident client.Incident) IncidentTableRow

FormatIncident converts a single SDK Incident into a table-displayable row.

func (*IncidentTableFormatter) FormatIncidentDetail

func (f *IncidentTableFormatter) FormatIncidentDetail(incident client.Incident) IncidentDetail

FormatIncidentDetail converts a single SDK Incident into a detailed view showing the full message and timeline information.

func (*IncidentTableFormatter) FormatIncidents

func (f *IncidentTableFormatter) FormatIncidents(incidents []client.Incident) []IncidentTableRow

FormatIncidents converts a slice of SDK Incidents into table-displayable rows.

type IncidentTableRow

type IncidentTableRow struct {
	ID      string `table:"ID"`
	Title   string `table:"TITLE"`
	Status  string `table:"STATUS"`
	Impact  string `table:"IMPACT"`
	Created string `table:"CREATED"`
	// Wide mode columns
	Updated  string `table:"UPDATED,wide"`
	Resolved string `table:"RESOLVED,wide"`
}

IncidentTableRow represents a row in the incident table output. The struct tags control column headers and wide mode display.

type InvitationRevokedResponse

type InvitationRevokedResponse struct {
	InvitationID string `json:"invitation_id"`
	Email        string `json:"email"`
	Revoked      bool   `json:"revoked"`
}

InvitationRevokedResponse is returned for JSON/YAML output when revoking an invitation.

type InvitationTableFormatter

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

InvitationTableFormatter converts SDK Invitation types to table-displayable rows.

func NewInvitationTableFormatter

func NewInvitationTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *InvitationTableFormatter

NewInvitationTableFormatter creates a new formatter for invitation table output. The colorMode parameter controls whether colors are applied. Set isWide to true for extended output with additional columns.

func (*InvitationTableFormatter) FormatInvitation

func (f *InvitationTableFormatter) FormatInvitation(invitation client.Invitation) InvitationTableRow

FormatInvitation converts a single SDK Invitation into a table-displayable row.

func (*InvitationTableFormatter) FormatInvitations

func (f *InvitationTableFormatter) FormatInvitations(invitations []client.Invitation) []InvitationTableRow

FormatInvitations converts a slice of SDK Invitations into table-displayable rows.

type InvitationTableRow

type InvitationTableRow struct {
	Email      string `table:"EMAIL"`
	Role       string `table:"ROLE"`
	InviteCode string `table:"INVITE_CODE"`
	Expires    string `table:"EXPIRES"`
	// Wide mode columns
	ID        string `table:"ID,wide"`
	InvitedBy string `table:"INVITED_BY,wide"`
}

InvitationTableRow represents a row in the invitation table output. The struct tags control column headers and wide mode display.

type InvoiceTableFormatter

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

InvoiceTableFormatter converts SDK Invoice types to table-displayable rows.

func NewInvoiceTableFormatter

func NewInvoiceTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *InvoiceTableFormatter

NewInvoiceTableFormatter creates a new formatter for invoice table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*InvoiceTableFormatter) FormatInvoice

func (f *InvoiceTableFormatter) FormatInvoice(invoice client.Invoice) InvoiceTableRow

FormatInvoice converts a single SDK Invoice into a table-displayable row.

func (*InvoiceTableFormatter) FormatInvoices

func (f *InvoiceTableFormatter) FormatInvoices(invoices []client.Invoice) []InvoiceTableRow

FormatInvoices converts a slice of SDK Invoices into table-displayable rows.

type InvoiceTableRow

type InvoiceTableRow struct {
	Number string `table:"NUMBER"`
	Date   string `table:"DATE"`
	Status string `table:"STATUS"`
	Amount string `table:"AMOUNT"`
	// Wide mode columns
	PaidAt string `table:"PAID,wide"`
	Period string `table:"PERIOD,wide"`
}

InvoiceTableRow represents a row for displaying invoice information. The struct tags control column headers and wide mode display.

type LabelKeyTableFormatter

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

LabelKeyTableFormatter converts SDK LabelKey types to table-displayable rows.

func NewLabelKeyTableFormatter

func NewLabelKeyTableFormatter(colorMode sdkoutput.ColorMode) *LabelKeyTableFormatter

NewLabelKeyTableFormatter creates a new formatter for label key table output.

func (*LabelKeyTableFormatter) FormatLabelKey

func (f *LabelKeyTableFormatter) FormatLabelKey(labelKey client.LabelKey) LabelKeyTableRow

FormatLabelKey converts a single SDK LabelKey into a table-displayable row.

func (*LabelKeyTableFormatter) FormatLabelKeys

func (f *LabelKeyTableFormatter) FormatLabelKeys(labelKeys []client.LabelKey) []LabelKeyTableRow

FormatLabelKeys converts a slice of SDK LabelKeys into table-displayable rows.

type LabelKeyTableRow

type LabelKeyTableRow struct {
	Key         string `table:"KEY"`
	DisplayName string `table:"DISPLAY NAME"`
	Color       string `table:"COLOR"`
	ValuesInUse string `table:"VALUES IN USE"`
	Probes      string `table:"PROBES"`
}

LabelKeyTableRow represents a row in the label key table output. The struct tags control column headers.

type MemberRemovedResponse

type MemberRemovedResponse struct {
	MemberID uint   `json:"member_id" yaml:"member_id"`
	Email    string `json:"email" yaml:"email"`
	Removed  bool   `json:"removed" yaml:"removed"`
}

MemberRemovedResponse represents the response for member removal. Used for JSON/YAML output formats.

type MuteTableFormatter

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

MuteTableFormatter converts SDK AlertMute types to table-displayable rows with status coloring support.

func NewMuteTableFormatter

func NewMuteTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *MuteTableFormatter

NewMuteTableFormatter creates a new formatter for mute table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*MuteTableFormatter) FormatMute

func (f *MuteTableFormatter) FormatMute(mute client.AlertMute) MuteTableRow

FormatMute converts a single SDK AlertMute into a table-displayable row.

func (*MuteTableFormatter) FormatMutes

func (f *MuteTableFormatter) FormatMutes(mutes []client.AlertMute) []MuteTableRow

FormatMutes converts a slice of SDK AlertMutes into table-displayable rows. Status fields are colored based on mute state:

  • active: green (ACTIVE)
  • expired: yellow (EXPIRED)

type MuteTableRow

type MuteTableRow struct {
	Status    string `table:"STATUS"`
	Scope     string `table:"SCOPE"`
	Target    string `table:"TARGET"`
	Duration  string `table:"DURATION"`
	ExpiresAt string `table:"EXPIRES"`
	Reason    string `table:"REASON"`
	// Wide mode columns
	Maintenance string `table:"MAINTENANCE,wide"`
	Created     string `table:"CREATED,wide"`
	ID          string `table:"ID,wide"`
}

MuteTableRow represents a row in the mute table output. The struct tags control column headers and wide mode display.

type OrgTableFormatter

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

OrgTableFormatter converts SDK Organization types to table-displayable rows with current organization indicator coloring support.

func NewOrgTableFormatter

func NewOrgTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *OrgTableFormatter

NewOrgTableFormatter creates a new formatter for organization table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*OrgTableFormatter) FormatOrganization

func (f *OrgTableFormatter) FormatOrganization(org client.Organization) OrgTableRow

FormatOrganization converts a single SDK Organization into a table-displayable row.

func (*OrgTableFormatter) FormatOrganizations

func (f *OrgTableFormatter) FormatOrganizations(orgs []client.Organization) []OrgTableRow

FormatOrganizations converts a slice of SDK Organizations into table-displayable rows. The current organization is indicated with a green checkmark in the STATUS column.

type OrgTableRow

type OrgTableRow struct {
	Status string `table:"STATUS"`
	Name   string `table:"NAME"`
	Slug   string `table:"SLUG"`
	Role   string `table:"ROLE"`
	// Wide mode columns
	ID string `table:"ID,wide"`
}

OrgTableRow represents a row in the organization table output. The struct tags control column headers and wide mode display.

type Printer

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

Printer wraps an SDK formatter and provides CLI-specific output helpers.

func NewPrinter

func NewPrinter(cfg *config.Config) *Printer

NewPrinter creates a new Printer using the given configuration. If cfg is nil, default options are used (table format, auto color).

func NewPrinterWithOptions

func NewPrinterWithOptions(opts *sdkoutput.Options) *Printer

NewPrinterWithOptions creates a Printer with explicit options. This is useful for testing or when fine-grained control is needed.

func (*Printer) Format

func (p *Printer) Format() sdkoutput.Format

Format returns the current output format.

func (*Printer) Print

func (p *Printer) Print(data any) error

Print formats and outputs data using the configured format. Data can be a struct, pointer to struct, or slice of structs. Empty slices produce no output (for JSON/YAML) or a blank line (for tables).

func (*Printer) PrintEmpty

func (p *Printer) PrintEmpty(message string) error

PrintEmpty outputs a user-friendly message when no results are found. For table format, prints the message to the configured writer. For JSON/YAML, outputs an empty array [].

func (*Printer) PrintError

func (p *Printer) PrintError(err error) error

PrintError formats and outputs an error message. For table format, outputs "Error: <message>" to stderr. For JSON/YAML, outputs {"error": "<message>"} to stderr.

func (*Printer) SetErrWriter

func (p *Printer) SetErrWriter(w io.Writer)

SetErrWriter changes the output destination for errors.

func (*Printer) SetWriter

func (p *Printer) SetWriter(w io.Writer)

SetWriter changes the output destination for data.

type ProbeLabelTableRow

type ProbeLabelTableRow struct {
	Key   string `table:"KEY"`
	Value string `table:"VALUE"`
}

ProbeLabelTableRow represents a row in the probe label table output. Task #8068

func FormatProbeLabels

func FormatProbeLabels(labels []client.ProbeLabel) []ProbeLabelTableRow

FormatProbeLabels converts a slice of probe labels into table-displayable rows. Task #8068

type ProbeStatusTableRow

type ProbeStatusTableRow struct {
	Name         string `table:"NAME"`
	Status       string `table:"STATUS"`
	Uptime       string `table:"UPTIME"`
	ResponseTime string `table:"RESPONSE"`
	// Wide mode columns
	ProbeID string `table:"PROBE ID,wide"`
}

ProbeStatusTableRow represents a row in the aggregated status table output. The struct tags control column headers and wide mode display.

type ProbeTableFormatter

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

ProbeTableFormatter converts SDK Probe types to table-displayable rows with status coloring support.

func NewProbeTableFormatter

func NewProbeTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *ProbeTableFormatter

NewProbeTableFormatter creates a new formatter for probe table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*ProbeTableFormatter) FormatProbe

func (f *ProbeTableFormatter) FormatProbe(probe client.Probe) ProbeTableRow

FormatProbe converts a single SDK Probe into a table-displayable row.

func (*ProbeTableFormatter) FormatProbes

func (f *ProbeTableFormatter) FormatProbes(probes []client.Probe) []ProbeTableRow

FormatProbes converts a slice of SDK Probes into table-displayable rows. Status fields are colored based on probe state:

  • up/healthy: green
  • down/error: red
  • degraded: yellow
  • paused/pending: no color (plain text)

type ProbeTableRow

type ProbeTableRow struct {
	Status    string `table:"STATUS"`
	Name      string `table:"NAME"`
	URL       string `table:"URL"`
	Deps      string `table:"DEPS"`
	Interval  string `table:"INTERVAL"`
	LastCheck string `table:"LAST CHECK"`
	// Wide mode columns
	Type    string `table:"TYPE,wide"`
	Uptime  string `table:"UPTIME,wide"`
	AvgResp string `table:"AVG RESP,wide"`
	Regions string `table:"REGIONS,wide"`
	Labels  string `table:"LABELS,wide"` // Task #8070
	ID      string `table:"ID,wide"`
}

ProbeTableRow represents a row in the probe table output. The struct tags control column headers and wide mode display.

type ProgressBar

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

ProgressBar provides a text-based progress bar for bulk operations. It auto-disables when stderr is not a TTY, when --no-input is set, or when output format is JSON/YAML. Use for operations with known item counts (import, export, bulk pause/resume).

Usage:

bar := NewProgressBar(100, "Importing probes...", WithBarDisabled(false))
for i := 0; i < 100; i++ {
    bar.Increment()
}
bar.Complete()

func NewProgressBar

func NewProgressBar(total int, message string, opts ...ProgressBarOption) *ProgressBar

NewProgressBar creates a new progress bar with the given total and message. The bar auto-disables when stderr is not a TTY, --no-input is set, STACKEYE_NO_INPUT is set, or output format is JSON/YAML. Use WithBarDisabled(false) to force-enable regardless of environment.

func (*ProgressBar) Complete

func (p *ProgressBar) Complete()

Complete marks the progress bar as complete and prints a newline. If the bar is disabled or total is zero, this is a no-op.

func (*ProgressBar) CompleteWithError

func (p *ProgressBar) CompleteWithError(message string)

CompleteWithError marks the bar as complete and prints an error message. If the bar is disabled, no output is produced.

func (*ProgressBar) CompleteWithSuccess

func (p *ProgressBar) CompleteWithSuccess(message string)

CompleteWithSuccess marks the bar as complete and prints a success message. If the bar is disabled, no output is produced.

func (*ProgressBar) Disabled

func (p *ProgressBar) Disabled() bool

Disabled returns true if the progress bar is disabled and will not display output.

func (*ProgressBar) Increment

func (p *ProgressBar) Increment()

Increment advances the progress bar by one step. If the bar is disabled, this is a no-op.

func (*ProgressBar) Set

func (p *ProgressBar) Set(current int)

Set sets the current progress value. If the bar is disabled, this is a no-op.

func (*ProgressBar) SetWriter

func (p *ProgressBar) SetWriter(w io.Writer)

SetWriter sets the output writer for the progress bar. Deprecated: Use WithBarWriter option in NewProgressBar instead.

type ProgressBarOption

type ProgressBarOption func(*ProgressBar)

ProgressBarOption configures a ProgressBar.

func WithBarDisabled

func WithBarDisabled(disabled bool) ProgressBarOption

WithBarDisabled explicitly sets the progress bar's disabled state. When disabled, Increment/Set/Complete produce no output.

func WithBarWidth

func WithBarWidth(width int) ProgressBarOption

WithBarWidth sets the visual width of the progress bar in characters.

func WithBarWriter

func WithBarWriter(w io.Writer) ProgressBarOption

WithBarWriter sets the output writer for the progress bar.

type RegionStatusFormatter

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

RegionStatusFormatter converts SDK RegionStatus types to table-displayable rows.

func NewRegionStatusFormatter

func NewRegionStatusFormatter(colorMode sdkoutput.ColorMode, isWide bool) *RegionStatusFormatter

NewRegionStatusFormatter creates a new formatter for region status table output. The colorMode parameter controls whether colors are applied. Set isWide to true for extended output with maintenance column.

func (*RegionStatusFormatter) FormatRegionStatus

func (f *RegionStatusFormatter) FormatRegionStatus(status client.RegionStatus) RegionStatusTableRow

FormatRegionStatus converts a single SDK RegionStatus into a table-displayable row.

func (*RegionStatusFormatter) FormatRegionStatuses

func (f *RegionStatusFormatter) FormatRegionStatuses(statuses []client.RegionStatus) []RegionStatusTableRow

FormatRegionStatuses converts a slice of region statuses into table-displayable rows. Statuses are sorted by region name for consistent output.

type RegionStatusTableRow

type RegionStatusTableRow struct {
	Code        string `table:"CODE"`
	Name        string `table:"NAME"`
	Status      string `table:"STATUS"`
	Health      string `table:"HEALTH"`
	Maintenance string `table:"MAINTENANCE,wide"`
}

RegionStatusTableRow represents a row in the region status table output. The struct tags control column headers and wide mode display.

type RegionTableFormatter

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

RegionTableFormatter converts SDK Region types to table-displayable rows.

func NewRegionTableFormatter

func NewRegionTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *RegionTableFormatter

NewRegionTableFormatter creates a new formatter for region table output. The colorMode parameter controls whether colors are applied. Set isWide to true for extended output with continent column.

func (*RegionTableFormatter) FormatRegion

func (f *RegionTableFormatter) FormatRegion(region client.Region, continent string) RegionTableRow

FormatRegion converts a single SDK Region into a table-displayable row.

func (*RegionTableFormatter) FormatRegions

func (f *RegionTableFormatter) FormatRegions(regionsByContinent map[string][]client.Region) []RegionTableRow

FormatRegions converts a map of regions grouped by continent into table-displayable rows. Regions are sorted by continent then by name for consistent output.

func (*RegionTableFormatter) FormatRegionsFlat

func (f *RegionTableFormatter) FormatRegionsFlat(regions []client.Region) []RegionTableRow

FormatRegionsFlat converts a flat slice of regions into table-displayable rows. Regions are sorted by name for consistent output. Continent column shows "-".

type RegionTableRow

type RegionTableRow struct {
	Code      string `table:"CODE"`
	Name      string `table:"NAME"`
	Display   string `table:"DISPLAY"`
	Country   string `table:"COUNTRY"`
	Continent string `table:"CONTINENT,wide"`
}

RegionTableRow represents a row in the region table output. The struct tags control column headers and wide mode display.

type Spinner

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

Spinner provides a simple text-based spinner for long-running operations. It displays a spinning animation with an optional message to indicate progress. The spinner auto-disables when stderr is not a TTY, when --no-input is set, or when output format is JSON/YAML.

Usage:

spin := NewSpinner("Loading probes...")
spin.Start()
defer spin.Stop()
// ... perform long operation
spin.Stop()

func NewSpinner

func NewSpinner(message string, opts ...SpinnerOption) *Spinner

NewSpinner creates a new spinner with the given message. The spinner auto-disables when stderr is not a TTY, --no-input is set, STACKEYE_NO_INPUT is set, or output format is JSON/YAML. Use WithDisabled(false) to force-enable the spinner regardless of environment.

func (*Spinner) Disabled

func (s *Spinner) Disabled() bool

Disabled returns true if the spinner is disabled and will not display output.

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation. The spinner runs in a separate goroutine until Stop is called. If the spinner is disabled (non-TTY, --no-input, JSON/YAML output), this is a no-op.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop halts the spinner animation and clears the line.

func (*Spinner) StopWithError

func (s *Spinner) StopWithError(message string)

StopWithError stops the spinner with an error indicator. If the spinner is disabled, no output is produced.

func (*Spinner) StopWithMessage

func (s *Spinner) StopWithMessage(message string)

StopWithMessage stops the spinner and prints a final message. If the spinner is disabled, no output is produced.

func (*Spinner) StopWithSuccess

func (s *Spinner) StopWithSuccess(message string)

StopWithSuccess stops the spinner with a success indicator. If the spinner is disabled, no output is produced.

func (*Spinner) UpdateMessage

func (s *Spinner) UpdateMessage(message string)

UpdateMessage changes the spinner message while running.

type SpinnerOption

type SpinnerOption func(*Spinner)

SpinnerOption configures a Spinner.

func WithDisabled

func WithDisabled(disabled bool) SpinnerOption

WithDisabled explicitly sets the spinner's disabled state. When disabled, Start() is a no-op and the spinner produces no output.

func WithFrames

func WithFrames(frames []string) SpinnerOption

WithFrames sets custom spinner frames.

func WithInterval

func WithInterval(d time.Duration) SpinnerOption

WithInterval sets the animation interval.

func WithWriter

func WithWriter(w io.Writer) SpinnerOption

WithWriter sets the output writer for the spinner.

type StatusPageTableFormatter

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

StatusPageTableFormatter converts SDK StatusPage types to table-displayable rows with status coloring support.

func NewStatusPageTableFormatter

func NewStatusPageTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *StatusPageTableFormatter

NewStatusPageTableFormatter creates a new formatter for status page table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*StatusPageTableFormatter) FormatStatusPage

FormatStatusPage converts a single SDK StatusPage into a table-displayable row.

func (*StatusPageTableFormatter) FormatStatusPages

func (f *StatusPageTableFormatter) FormatStatusPages(pages []client.StatusPage) []StatusPageTableRow

FormatStatusPages converts a slice of SDK StatusPages into table-displayable rows.

type StatusPageTableRow

type StatusPageTableRow struct {
	Name    string `table:"NAME"`
	Slug    string `table:"SLUG"`
	Theme   string `table:"THEME"`
	Public  string `table:"PUBLIC"`
	Enabled string `table:"ENABLED"`
	Probes  string `table:"PROBES"`
	// Wide mode columns
	Domain  string `table:"DOMAIN,wide"`
	Uptime  string `table:"UPTIME%,wide"`
	ID      string `table:"ID,wide"`
	Created string `table:"CREATED,wide"`
}

StatusPageTableRow represents a row in the status page table output. The struct tags control column headers and wide mode display.

type SubscriptionTableFormatter

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

SubscriptionTableFormatter converts SDK BillingInfo to table-displayable rows.

func NewSubscriptionTableFormatter

func NewSubscriptionTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *SubscriptionTableFormatter

NewSubscriptionTableFormatter creates a new formatter for subscription table output. The colorMode parameter controls whether status colors are applied. Set isWide to true for extended output with additional columns.

func (*SubscriptionTableFormatter) FormatSubscription

FormatSubscription converts SDK BillingInfo into a table-displayable row.

type SubscriptionTableRow

type SubscriptionTableRow struct {
	Plan     string `table:"PLAN"`
	Status   string `table:"STATUS"`
	Monitors string `table:"MONITORS"`
	// Wide mode columns
	BillingEmail string `table:"BILLING EMAIL,wide"`
	NextBilling  string `table:"NEXT BILLING,wide"`
	Amount       string `table:"AMOUNT,wide"`
}

SubscriptionTableRow represents a row for displaying billing subscription info. The struct tags control column headers and wide mode display.

type TeamMemberTableFormatter

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

TeamMemberTableFormatter converts SDK TeamMember types to table-displayable rows.

func NewTeamMemberTableFormatter

func NewTeamMemberTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *TeamMemberTableFormatter

NewTeamMemberTableFormatter creates a new formatter for team member table output. The colorMode parameter controls whether colors are applied. Set isWide to true for extended output with additional columns.

func (*TeamMemberTableFormatter) FormatTeamMember

func (f *TeamMemberTableFormatter) FormatTeamMember(member client.TeamMember) TeamMemberTableRow

FormatTeamMember converts a single SDK TeamMember into a table-displayable row.

func (*TeamMemberTableFormatter) FormatTeamMembers

func (f *TeamMemberTableFormatter) FormatTeamMembers(members []client.TeamMember) []TeamMemberTableRow

FormatTeamMembers converts a slice of SDK TeamMembers into table-displayable rows.

type TeamMemberTableRow

type TeamMemberTableRow struct {
	Name   string `table:"NAME"`
	Email  string `table:"EMAIL"`
	Role   string `table:"ROLE"`
	Joined string `table:"JOINED"`
	// Wide mode columns
	ID     string `table:"ID,wide"`
	UserID string `table:"USER_ID,wide"`
}

TeamMemberTableRow represents a row in the team member table output. The struct tags control column headers and wide mode display.

type TreeNode

type TreeNode struct {
	// Name is the display name for this node
	Name string
	// Status is the status text (e.g., "up", "down", "unreachable")
	Status string
	// Children are the child nodes in the tree
	Children []*TreeNode
}

TreeNode represents a node in an ASCII tree. Task #8027: Supports dependency tree visualization.

type TreePrinter

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

TreePrinter renders ASCII tree diagrams with optional color support.

func NewTreePrinter

func NewTreePrinter(colorMode sdkoutput.ColorMode, useASCII bool) *TreePrinter

NewTreePrinter creates a new TreePrinter with the given options.

func (*TreePrinter) PrintOrphanSection

func (p *TreePrinter) PrintOrphanSection(title string, orphans []*TreeNode)

PrintOrphanSection prints a separate section for orphan nodes.

func (*TreePrinter) PrintTree

func (p *TreePrinter) PrintTree(roots []*TreeNode)

PrintTree renders the tree starting from the given root nodes. Multiple root nodes are rendered as separate trees.

func (*TreePrinter) SetWriter

func (p *TreePrinter) SetWriter(w io.Writer)

SetWriter changes the output destination.

type UsageTableFormatter

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

UsageTableFormatter converts SDK UsageInfo to table-displayable rows.

func NewUsageTableFormatter

func NewUsageTableFormatter(colorMode sdkoutput.ColorMode, isWide bool) *UsageTableFormatter

NewUsageTableFormatter creates a new formatter for usage table output. The colorMode parameter controls whether usage bars are colored. Set isWide to true for extended output with visual usage bars.

func (*UsageTableFormatter) FormatUsage

func (f *UsageTableFormatter) FormatUsage(usage *client.UsageInfo) []UsageTableRow

FormatUsage converts SDK UsageInfo into table-displayable rows. Returns multiple rows, one for each resource type (monitors, team members, checks).

type UsageTableRow

type UsageTableRow struct {
	Resource string `table:"RESOURCE"`
	Used     string `table:"USED"`
	Limit    string `table:"LIMIT"`
	Percent  string `table:"PERCENT"`
	// Wide mode columns
	Bar string `table:"USAGE BAR,wide"`
}

UsageTableRow represents a row for displaying resource usage metrics. Multiple rows are used to show different resource types.

Jump to

Keyboard shortcuts

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