output

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 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 BuildResult

type BuildResult struct {
	Version     string   `json:"version"`
	Commit      string   `json:"commit"`
	ShortCommit string   `json:"short_commit"`
	Date        string   `json:"date"`
	OutputDir   string   `json:"output_dir"`
	Targets     []string `json:"targets"`
	Binaries    []string `json:"binaries,omitempty"`
	Message     string   `json:"message,omitempty"`
}

BuildResult represents the result of a build command

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 ImageResult

type ImageResult struct {
	Version     string   `json:"version"`
	Commit      string   `json:"commit"`
	ShortCommit string   `json:"short_commit"`
	Repository  string   `json:"repository"`
	Tags        []string `json:"tags"`
	Platforms   []string `json:"platforms"`
	Pushed      bool     `json:"pushed"`
	Message     string   `json:"message,omitempty"`
}

ImageResult represents the result of an image command

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 interface{}) 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 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