output

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package output handles formatting and displaying results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action represents the action taken or planned for a pull request.

const (
	// Analysis mode actions (what would happen)
	ActionWouldMerge  Action = "would merge"
	ActionWouldRebase Action = "would rebase"
	ActionReadyMerge  Action = "ready to merge" // Ready but merge not enabled

	// Execution mode actions (what happened)
	ActionMerged       Action = "merged"
	ActionMergeFailed  Action = "merge failed"
	ActionRebased      Action = "rebased"
	ActionRebaseFailed Action = "rebase failed"

	// Skip reasons
	ActionSkipNotTargetingDefault Action = "skip: not targeting default branch"
	ActionSkipBranchNoMatch       Action = "skip: branch does not match source pattern"
	ActionSkipDraft               Action = "skip: draft PR"
	ActionSkipConflict            Action = "skip: merge conflict"
	ActionSkipChecksFailing       Action = "skip: checks failing"
	ActionSkipChecksPending       Action = "skip: checks pending"
	ActionSkipNoChecks            Action = "skip: no checks found"
	ActionSkipBranchBehind        Action = "skip: branch behind default"
	ActionSkipAwaitingChecks      Action = "skip: branch updated, awaiting checks"
	ActionSkipPermissions         Action = "skip: insufficient permissions"
	ActionSkipAPIError            Action = "skip: API error"
	ActionSkipRepoLimit           Action = "skip: repo limit reached"
)

type Console added in v0.2.0

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

Console handles colored, formatted terminal output with progress bar support.

func NewConsole added in v0.2.0

func NewConsole(w io.Writer, noColor, verbose bool) *Console

NewConsole creates a new Console for terminal output.

func (*Console) Bold added in v0.2.0

func (c *Console) Bold(s string) string

Bold returns a bold string.

func (*Console) ClearCurrentLine added in v0.2.0

func (c *Console) ClearCurrentLine()

ClearCurrentLine clears the current terminal line.

func (*Console) ClearLines added in v0.2.0

func (c *Console) ClearLines(n int)

ClearLines clears n lines above the current position using ANSI escape codes.

func (*Console) Cyan added in v0.2.0

func (c *Console) Cyan(s string) string

Cyan returns a cyan colored string.

func (*Console) Dim added in v0.2.0

func (c *Console) Dim(s string) string

Dim returns a dim string.

func (*Console) FinishProgress added in v0.2.0

func (c *Console) FinishProgress()

FinishProgress completes the progress bar by adding a newline.

func (*Console) Green added in v0.2.0

func (c *Console) Green(s string) string

Green returns a green colored string.

func (*Console) IsVerbose added in v0.2.0

func (c *Console) IsVerbose() bool

IsVerbose returns whether verbose mode is enabled.

func (*Console) PrintHeader added in v0.2.0

func (c *Console) PrintHeader(org, mode, branch string)

PrintHeader prints the application header.

func (*Console) PrintPendingAction added in v0.2.0

func (c *Console) PrintPendingAction(repo RepositoryResult, pr PullRequestResult) int

PrintPendingAction prints a single pending action line for confirmation mode. It returns the number of terminal lines written.

func (*Console) PrintRepoResult added in v0.2.0

func (c *Console) PrintRepoResult(repo RepositoryResult) int

PrintRepoResult prints the result for a single repository's pull requests. It returns the number of terminal lines written.

func (*Console) PrintSummary added in v0.2.0

func (c *Console) PrintSummary(summary RunSummary)

PrintSummary prints a condensed summary line.

func (*Console) ProgressBar added in v0.2.0

func (c *Console) ProgressBar(current, total int, label string)

ProgressBar renders a progress bar on the current line using carriage return.

func (*Console) Red added in v0.2.0

func (c *Console) Red(s string) string

Red returns a red colored string.

func (*Console) Writer added in v0.2.0

func (c *Console) Writer() io.Writer

Writer returns the underlying io.Writer.

func (*Console) Yellow added in v0.2.0

func (c *Console) Yellow(s string) string

Yellow returns a yellow colored string.

type PullRequestResult

type PullRequestResult struct {
	Number     int        `json:"number"`
	URL        string     `json:"url"`
	HeadBranch string     `json:"head_branch"`
	Title      string     `json:"title"`
	Action     Action     `json:"action"`
	Reason     string     `json:"reason,omitempty"`
	SkipReason SkipReason `json:"skip_reason,omitempty"`
}

PullRequestResult represents the result for a single pull request.

type RepositoryResult

type RepositoryResult struct {
	Name          string              `json:"name"`
	FullName      string              `json:"full_name"`
	DefaultBranch string              `json:"default_branch"`
	PullRequests  []PullRequestResult `json:"pull_requests"`
	Skipped       bool                `json:"skipped,omitempty"`
	SkipReason    string              `json:"skip_reason,omitempty"`
}

RepositoryResult represents the results for a single repository.

type RunMetadata

type RunMetadata struct {
	Org           string    `json:"org"`
	SourceBranch  string    `json:"source_branch"`
	Mode          string    `json:"mode"`
	Rebase        bool      `json:"rebase"`
	Merge         bool      `json:"merge"`
	RepoLimit     int       `json:"repo_limit,omitempty"`
	RepoLimitDesc string    `json:"repo_limit_desc,omitempty"`
	StartTime     time.Time `json:"start_time"`
	EndTime       time.Time `json:"end_time"`
}

RunMetadata contains metadata about the run.

type RunResult

type RunResult struct {
	Metadata     RunMetadata        `json:"metadata"`
	Repositories []RepositoryResult `json:"repositories"`
	Summary      RunSummary         `json:"summary"`
}

RunResult represents the complete result of a run.

type RunSummary

type RunSummary struct {
	ReposProcessed  int            `json:"repos_processed"`
	ReposSkipped    int            `json:"repos_skipped"`
	CandidatesFound int            `json:"candidates_found"`
	MergedSuccess   int            `json:"merged_success"`
	MergeFailed     int            `json:"merge_failed"`
	RebasedSuccess  int            `json:"rebased_success"`
	RebaseFailed    int            `json:"rebase_failed"`
	WouldMerge      int            `json:"would_merge,omitempty"`
	WouldRebase     int            `json:"would_rebase,omitempty"`
	ReadyToMerge    int            `json:"ready_to_merge,omitempty"`
	Skipped         int            `json:"skipped"`
	SkippedByReason map[string]int `json:"skipped_by_reason,omitempty"`
}

RunSummary contains summary statistics for the run.

type SkipReason

type SkipReason string

SkipReason represents a categorized skip reason for summary grouping.

const (
	ReasonNotTargetingDefault SkipReason = "not targeting default branch"
	ReasonBranchNoMatch       SkipReason = "branch does not match source pattern"
	ReasonDraft               SkipReason = "draft PR"
	ReasonConflict            SkipReason = "merge conflict"
	ReasonChecksFailing       SkipReason = "checks failing"
	ReasonChecksPending       SkipReason = "checks pending"
	ReasonNoChecks            SkipReason = "no checks found"
	ReasonBranchBehind        SkipReason = "branch behind default"
	ReasonAwaitingChecks      SkipReason = "branch updated, awaiting checks"
	ReasonPermissions         SkipReason = "insufficient permissions"
	ReasonAPIError            SkipReason = "API error"
	ReasonRepoLimit           SkipReason = "repo limit reached"
)

type Writer

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

Writer handles output formatting.

func NewWriter

func NewWriter(out io.Writer, jsonMode bool, noColor bool) *Writer

NewWriter creates a new Writer.

func (*Writer) WriteResult

func (w *Writer) WriteResult(result *RunResult) error

WriteResult writes the complete run result.

Jump to

Keyboard shortcuts

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