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.
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 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.
Index ¶
- func FormatIncidentCount(total int64, page, limit int) string
- func FormatStatusPageCount(total int64, page, limit int) string
- func Print(data any) error
- func PrintAPIKey(key client.APIKey) error
- func PrintAPIKeys(keys []client.APIKey) error
- func PrintAggregatedStatus(status client.AggregatedStatusResponse) error
- func PrintAlert(alert client.Alert) error
- func PrintAlertStats(stats *client.AlertStats) error
- func PrintAlerts(alerts []client.Alert) error
- func PrintChannel(channel client.Channel) error
- func PrintChannels(channels []client.Channel) error
- func PrintDomainVerification(verification client.DomainVerificationResponse) error
- func PrintEmpty(message string) error
- func PrintError(err error) error
- func PrintIfNotEmpty(data any, emptyMessage string) error
- func PrintIncident(incident client.Incident) error
- func PrintIncidents(incidents []client.Incident) error
- func PrintInvitation(invitation *client.Invitation) error
- func PrintInvitationCreated(invitation *client.Invitation) error
- func PrintInvitationRevoked(invitationID, email string) error
- func PrintInvitations(invitations []client.Invitation) error
- func PrintInvoice(invoice client.Invoice) error
- func PrintInvoices(invoices []client.Invoice) error
- func PrintMemberRemoved(memberID uint, email string) error
- func PrintMute(mute client.AlertMute) error
- func PrintMutes(mutes []client.AlertMute) error
- func PrintOrganization(org client.Organization) error
- func PrintOrganizations(orgs []client.Organization) error
- func PrintProbe(probe client.Probe) error
- func PrintProbes(probes []client.Probe) error
- func PrintRegionStatus(status client.RegionStatus) error
- func PrintRegionStatuses(statuses []client.RegionStatus) error
- func PrintRegions(regionsByContinent map[string][]client.Region) error
- func PrintRegionsFlat(regions []client.Region) error
- func PrintRoleUpdated(result *client.UpdateMemberRoleResponse) error
- func PrintStatusPage(page client.StatusPage) error
- func PrintStatusPages(pages []client.StatusPage) error
- func PrintSubscription(info *client.BillingInfo) error
- func PrintTeamMember(member client.TeamMember) error
- func PrintTeamMembers(members []client.TeamMember) error
- func PrintUsage(usage *client.UsageInfo) error
- func SetConfigGetter(getter func() *config.Config)
- type APIKeyTableFormatter
- type APIKeyTableRow
- type AggregatedStatusTableFormatter
- type AlertStatsFormatter
- type AlertStatsRow
- type AlertTableFormatter
- type AlertTableRow
- type ChannelTableFormatter
- type ChannelTableRow
- type DomainVerificationTableRow
- type IncidentTableFormatter
- type IncidentTableRow
- type InvitationRevokedResponse
- type InvitationTableFormatter
- type InvitationTableRow
- type InvoiceTableFormatter
- type InvoiceTableRow
- type MemberRemovedResponse
- type MuteTableFormatter
- type MuteTableRow
- type OrgTableFormatter
- type OrgTableRow
- type Printer
- type ProbeStatusTableRow
- type ProbeTableFormatter
- type ProbeTableRow
- type RegionStatusFormatter
- type RegionStatusTableRow
- type RegionTableFormatter
- type RegionTableRow
- type StatusPageTableFormatter
- type StatusPageTableRow
- type SubscriptionTableFormatter
- type SubscriptionTableRow
- type TeamMemberTableFormatter
- type TeamMemberTableRow
- type UsageTableFormatter
- type UsageTableRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatIncidentCount ¶
FormatIncidentCount formats the total count for pagination display.
func FormatStatusPageCount ¶
FormatStatusPageCount formats the total count for pagination display.
func Print ¶
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 ¶
PrintAPIKey is a convenience function that formats and prints a single API key.
func PrintAPIKeys ¶
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 ¶
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 ¶
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 ¶
PrintChannel is a convenience function that formats and prints a single channel.
func PrintChannels ¶
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 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 ¶
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 PrintError ¶
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 ¶
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 ¶
PrintIncident is a convenience function that formats and prints a single incident.
func PrintIncidents ¶
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 ¶
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 ¶
PrintInvoice is a convenience function that formats and prints a single invoice.
func PrintInvoices ¶
PrintInvoices is a convenience function that formats and prints invoices using the CLI's configured output format.
func PrintMemberRemoved ¶
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 PrintMutes ¶
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 ¶
PrintProbe is a convenience function that formats and prints a single probe.
func PrintProbes ¶
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 ¶
PrintRegions is a convenience function that formats and prints regions using the CLI's configured output format. It handles wide mode automatically.
func PrintRegionsFlat ¶
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 ¶
PrintUsage is a convenience function that formats and prints usage info using the CLI's configured output format.
func SetConfigGetter ¶
SetConfigGetter sets the function used to retrieve the current configuration. This should be called once during CLI initialization from the cmd package.
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 ¶
func (f *AggregatedStatusTableFormatter) FormatProbeStatuses(probes []client.ProbeStatusSummary) []ProbeStatusTableRow
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 ¶
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 DomainVerificationTableRow ¶
DomainVerificationTableRow represents a row in the domain verification table output. The struct tags control column headers.
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) 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 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 ¶
NewPrinter creates a new Printer using the given configuration. If cfg is nil, default options are used (table format, auto color).
func NewPrinterWithOptions ¶
NewPrinterWithOptions creates a Printer with explicit options. This is useful for testing or when fine-grained control is needed.
func (*Printer) Print ¶
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 ¶
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 ¶
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 ¶
SetErrWriter changes the output destination for errors.
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"`
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"`
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 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 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 ¶
func (f *StatusPageTableFormatter) FormatStatusPage(page client.StatusPage) StatusPageTableRow
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 ¶
func (f *SubscriptionTableFormatter) FormatSubscription(info *client.BillingInfo) SubscriptionTableRow
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 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.