Documentation
¶
Overview ¶
Package output handles formatting and displaying results.
Package output handles formatting and displaying results.
Index ¶
- func FormatReportEmptyJSON(w io.Writer) error
- type Action
- type Console
- func (c *Console) Bold(s string) string
- func (c *Console) ClearCurrentLine()
- func (c *Console) ClearLines(n int)
- func (c *Console) Cyan(s string) string
- func (c *Console) Dim(s string) string
- func (c *Console) FinishProgress()
- func (c *Console) Green(s string) string
- func (c *Console) IsVerbose() bool
- func (c *Console) PrintHeader(org, mode, branch string)
- func (c *Console) PrintPendingAction(repo RepositoryResult, pr PullRequestResult) int
- func (c *Console) PrintRepoResult(repo RepositoryResult) int
- func (c *Console) PrintReport(result *ReportResult, verbosity string)
- func (c *Console) PrintReportHeader(org string, repoCount int)
- func (c *Console) PrintReportSummary(totalGroups, totalPRs int)
- func (c *Console) PrintSummary(summary RunSummary)
- func (c *Console) ProgressBar(current, total int, label string)
- func (c *Console) Red(s string) string
- func (c *Console) Writer() io.Writer
- func (c *Console) Yellow(s string) string
- type PullRequestResult
- type ReportGroup
- type ReportPullRequest
- type ReportResult
- type RepositoryResult
- type RunMetadata
- type RunResult
- type RunSummary
- type SkipReason
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatReportEmptyJSON ¶ added in v0.3.0
FormatReportEmptyJSON returns an empty report JSON result with an empty groups array.
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
NewConsole creates a new Console for terminal output.
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
ClearLines clears n lines above the current position using ANSI escape codes.
func (*Console) FinishProgress ¶ added in v0.2.0
func (c *Console) FinishProgress()
FinishProgress completes the progress bar by adding a newline.
func (*Console) PrintHeader ¶ added in v0.2.0
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) PrintReport ¶ added in v0.3.0
func (c *Console) PrintReport(result *ReportResult, verbosity string)
PrintReport prints the report output to the console.
func (*Console) PrintReportHeader ¶ added in v0.3.0
PrintReportHeader prints the report header.
func (*Console) PrintReportSummary ¶ added in v0.3.0
PrintReportSummary prints the report summary line.
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
ProgressBar renders a progress bar on the current line using carriage return.
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 ReportGroup ¶ added in v0.3.0
type ReportGroup struct {
SourceBranch string `json:"sourceBranch"`
Count int `json:"count"`
PullRequests []ReportPullRequest `json:"pullRequests"`
}
ReportGroup represents a group of PRs sharing the same source branch.
type ReportPullRequest ¶ added in v0.3.0
type ReportPullRequest struct {
Repository string `json:"repository"`
Number int `json:"number"`
Status string `json:"status"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
}
ReportPullRequest represents a single PR in a report group.
type ReportResult ¶ added in v0.3.0
type ReportResult struct {
Groups []ReportGroup `json:"groups"`
}
ReportResult represents the complete report output.
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 (*Writer) WriteReportResult ¶ added in v0.3.0
func (w *Writer) WriteReportResult(result *ReportResult, verbosity string) error
WriteReportResult writes the report result in JSON or human-readable format.
func (*Writer) WriteResult ¶
WriteResult writes the complete run result.