output

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package output handles version formatting, promotion, and serialization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatExplanation

func FormatExplanation(result calculator.VersionResult) string

FormatExplanation returns the explain output as a string.

func GetVariables

func GetVariables(
	ver semver.SemanticVersion,
	ec config.EffectiveConfiguration,
) map[string]string

GetVariables computes all output variables for a version, applying mode-specific transformations (ContinuousDeployment promotion) and then computing format values.

func PromoteCommitsToPreRelease

func PromoteCommitsToPreRelease(
	ver semver.SemanticVersion,
	mode semver.VersioningMode,
	fallbackTag string,
) semver.SemanticVersion

PromoteCommitsToPreRelease transforms a version for ContinuousDeployment or Mainline modes by setting CommitsSinceTag as the pre-release number. This is a pure function — no side effects.

In ContinuousDeployment mode, commit count becomes the pre-release number:

1.2.0+5 → 1.2.0-ci.5 (using fallback tag "ci")

In ContinuousDelivery mode, the version is returned unchanged.

func WriteAll

func WriteAll(w io.Writer, variables map[string]string) error

WriteAll writes all variables as key=value pairs to the writer, sorted by key.

func WriteExplanation

func WriteExplanation(w io.Writer, result calculator.VersionResult) error

WriteExplanation writes a structured explain output for the version calculation to w. It shows all strategy candidates, the selected winner, increment reasoning, pre-release tag resolution, and the final result.

func WriteJSON

func WriteJSON(w io.Writer, variables map[string]string) error

WriteJSON writes all variables as pretty-printed JSON to the writer.

func WriteVariable

func WriteVariable(w io.Writer, variables map[string]string, name string) error

WriteVariable writes a single variable value to the writer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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