output

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithManager

func WithManager(ctx context.Context, manager *Manager) context.Context

WithManager adds the output manager to the context.

Types

type ErrorResult

type ErrorResult struct {
	Error   string `json:"error"`
	Message string `json:"message,omitempty"`
}

ErrorResult represents an error result.

type Format

type Format string

Format represents the output format type.

const (
	FormatText Format = "text"
	FormatJSON Format = "json"
)

type InitResult

type InitResult struct {
	OutputPath string `json:"output_path"`
	Created    bool   `json:"created"`
	Message    string `json:"message,omitempty"`
}

InitResult represents the result of an init command.

type Manager

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

Manager handles output formatting.

func FromContext

func FromContext(ctx context.Context) *Manager

FromContext retrieves the output manager from the context.

func New

func New(format Format) *Manager

New creates a new output manager.

func (*Manager) IsJSON

func (m *Manager) IsJSON() bool

IsJSON returns true if the output format is JSON.

func (*Manager) Print

func (m *Manager) Print(result any) error

Print outputs the result in the appropriate format.

func (*Manager) PrintError

func (m *Manager) PrintError(err error, message string)

PrintError outputs an error in the appropriate format.

type RetagResult added in v1.3.0

type RetagResult struct {
	Tag        string `json:"tag"`
	FromCommit string `json:"from_commit"`
	ToCommit   string `json:"to_commit"`
	Pushed     bool   `json:"pushed"`
	Message    string `json:"message,omitempty"`
}

RetagResult represents the result of a retag command.

type TagResult

type TagResult struct {
	Tag     string `json:"tag"`
	Pushed  bool   `json:"pushed"`
	Version string `json:"version,omitempty"`
	Message string `json:"message,omitempty"`
}

TagResult represents the result of a bump command (creates a git tag).

type VersionHistoryEntry

type VersionHistoryEntry struct {
	Version string `json:"version"`
	Tag     string `json:"tag"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
	Message string `json:"message,omitempty"`
}

VersionHistoryEntry represents a single version in the history.

type VersionHistoryResult

type VersionHistoryResult struct {
	Versions []VersionHistoryEntry `json:"versions"`
	Count    int                   `json:"count"`
}

VersionHistoryResult represents the result of a version history command.

type VersionResult

type VersionResult struct {
	Version string `json:"version"`
	Scheme  string `json:"scheme"`
	Commit  string `json:"commit"`
	Dirty   bool   `json:"dirty,omitempty"`
}

VersionResult represents the result of a version command.

type VersionTagResult

type VersionTagResult struct {
	Tag     string `json:"tag"`
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
	Message string `json:"message,omitempty"`
	Exists  bool   `json:"exists"`
}

VersionTagResult represents the result of querying a specific tag.

Jump to

Keyboard shortcuts

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