format

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package format provides TOON output formatting for the axi-forge CLI. It transforms domain types into TOON strings at the CLI output boundary, keeping TOON conversion separate from the provider layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthStatus

func AuthStatus(hosts []AuthRow) string

AuthStatus formats the auth status as TOON tabular output.

func Diagnostic

func Diagnostic(msg string) string

Diagnostic formats a diagnostic message (e.g., broken stack warning).

func Error

func Error(msg, help string) string

Error formats an error with an optional help hint as TOON output.

func IssueCloseConfirm

func IssueCloseConfirm(number int) string

IssueCloseConfirm formats an issue close confirmation.

func IssueCreateConfirm

func IssueCreateConfirm(number int, title, url string) string

IssueCreateConfirm formats an issue creation confirmation.

func IssueList

func IssueList(issues []IssueRow, count, total int, _ ...string) string

IssueList formats a list of issues as TOON tabular output. count is the number of items in this response; total is the total matching items. fields is accepted for backward compatibility but is unused — the caller always populates all fields, and omitempty controls column visibility.

func IssueView

func IssueView(issue *IssueDetail, full bool) string

IssueView formats a single issue as TOON key-value output. If full is false, the body is truncated to 500 characters.

func LabelCreateConfirm

func LabelCreateConfirm(name, scope string) string

LabelCreateConfirm formats a label creation confirmation.

func LabelDeleteConfirm

func LabelDeleteConfirm(name, scope string) string

LabelDeleteConfirm formats a label deletion confirmation.

func LabelList

func LabelList(labels []LabelRow, _ ...string) string

LabelList formats a list of labels as TOON tabular output. fields is accepted for backward compatibility but is unused — the caller always populates all fields, and omitempty controls column visibility.

func LabelUpdateConfirm

func LabelUpdateConfirm(name, scope string) string

LabelUpdateConfirm formats a label update confirmation.

func PRCreateConfirm

func PRCreateConfirm(number int, title, url string) string

PRCreateConfirm formats a PR creation confirmation.

func PRList

func PRList(prs []PRRow, count, total int, _ ...string) string

PRList formats a list of pull requests as TOON tabular output. fields is accepted for backward compatibility but is unused — the caller always populates all fields, and omitempty controls column visibility.

func PRMergeConfirm

func PRMergeConfirm(number int) string

PRMergeConfirm formats a PR merge confirmation.

func PRView

func PRView(pr *PRDetail, full bool) string

PRView formats a single pull request as TOON key-value output.

func TruncateBody

func TruncateBody(body string, maxLen int) (string, int)

TruncateBody truncates body to maxLen characters, appending "..." if truncated. Returns the truncated string and the original total size. A maxLen of 0 or less means no truncation.

Types

type AuthRow

type AuthRow struct {
	Forge  string `toon:"forge"`
	Host   string `toon:"host"`
	Source string `toon:"source"`
}

AuthRow is a single row in the auth status output.

type DepPR

type DepPR struct {
	Number int    `toon:"number"`
	Title  string `toon:"title"`
	State  string `toon:"state"`
}

DepPR is a dependency row in the PR view.

type IssueDetail

type IssueDetail struct {
	Number    int    `toon:"number"`
	Title     string `toon:"title"`
	State     string `toon:"state"`
	Body      string `toon:"body"`
	BodySize  int    `toon:"body_size"`
	Author    string `toon:"author"`
	CreatedAt string `toon:"created_at"`
	UpdatedAt string `toon:"updated_at"`
	URL       string `toon:"url"`
	Hint      string `toon:"hint,omitempty"`
}

IssueDetail is the full issue view output.

type IssueRow

type IssueRow struct {
	Number int    `toon:"number"`
	Title  string `toon:"title"`
	State  string `toon:"state"`
	Author string `toon:"author,omitempty"`
	Labels string `toon:"labels,omitempty"`
}

IssueRow is a single row in the issue list tabular output. Author and Labels are populated by the caller and suppressed via omitempty when --fields does not request them (TOON omits empty optional fields).

type LabelRow

type LabelRow struct {
	Name        string `toon:"name"`
	Scope       string `toon:"scope"`
	Color       string `toon:"color"`
	Description string `toon:"description"`
	Exclusive   bool   `toon:"exclusive,omitempty"`
}

LabelRow is a single row in the label list tabular output. Exclusive is populated by the caller and suppressed via omitempty when --fields does not request it.

type PRDetail

type PRDetail struct {
	Number       int             `toon:"number"`
	Title        string          `toon:"title"`
	State        string          `toon:"state"`
	Body         string          `toon:"body"`
	BodySize     int             `toon:"body_size"`
	BaseRef      string          `toon:"base_ref"`
	HeadRef      string          `toon:"head_ref"`
	Stack        string          `toon:"stack,omitempty"`
	Draft        bool            `toon:"draft,omitempty"`
	DependsOn    []DepPR         `toon:"depends_on"`
	DependedOnBy []DepPR         `toon:"depended_on_by"`
	Reviewers    []ReviewerState `toon:"reviewers,omitempty"`
	ChecksPassed int             `toon:"checks_passed,omitempty"`
	ChecksTotal  int             `toon:"checks_total,omitempty"`
	Author       string          `toon:"author"`
	CreatedAt    string          `toon:"created_at"`
	UpdatedAt    string          `toon:"updated_at"`
	URL          string          `toon:"url"`
	Hint         string          `toon:"hint,omitempty"`
}

PRDetail is the full PR view output.

type PRRow

type PRRow struct {
	Number  int    `toon:"number"`
	Stack   string `toon:"stack"`
	Title   string `toon:"title"`
	State   string `toon:"state"`
	Author  string `toon:"author,omitempty"`
	Created string `toon:"created,omitempty"`
}

PRRow is a single row in the PR list tabular output. Author and Created are populated by the caller and suppressed via omitempty when --fields does not request them.

type ReviewerState

type ReviewerState struct {
	Login string `toon:"login"`
	State string `toon:"state"`
}

ReviewerState is a reviewer row in the PR view.

Jump to

Keyboard shortcuts

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