version

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package version contains the version information for the CLI

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version injected at build time
	Version = "local"
	// Commit injected at build time
	Commit = "unknown"
	// BuildDate injected at build time
	BuildDate = "unknown"
)
View Source
var (

	// InstallMethodOverride is injected at build time for wrapped distributions
	// like the published Docker image.
	InstallMethodOverride = ""
)

Functions

func UpgradeCommand added in v1.1.1

func UpgradeCommand(method InstallMethod, latestVersion string) string

UpgradeCommand returns an executable upgrade instruction for the install method.

Types

type InstallInfo added in v1.1.1

type InstallInfo struct {
	Method InstallMethod
	Path   string
}

InstallInfo stores the detected installation method and binary path.

func GetInstallInfo added in v1.1.1

func GetInstallInfo() InstallInfo

GetInstallInfo returns the cached install details for the current process.

func (InstallInfo) DisplayName added in v1.1.1

func (i InstallInfo) DisplayName() string

DisplayName returns a user-facing description of the installation method.

type InstallMethod added in v1.1.1

type InstallMethod string

InstallMethod describes how the CLI binary was installed.

const (
	// InstallMethodCurl uses the Unix install script.
	InstallMethodCurl InstallMethod = "curl"
	// InstallMethodDocker uses the published Docker image.
	InstallMethodDocker InstallMethod = "docker"
	// InstallMethodGitHubActions runs through the GitHub Action.
	InstallMethodGitHubActions InstallMethod = "github-actions"
	// InstallMethodWindowsScript uses the PowerShell install script.
	InstallMethodWindowsScript InstallMethod = "windows-script"
	// InstallMethodManual covers binaries installed without a known wrapper.
	InstallMethodManual InstallMethod = "manual"
)

type UpdateInfo added in v1.1.1

type UpdateInfo struct {
	Current   string `json:"current,omitempty"`
	Latest    string `json:"latest,omitempty"`
	Available bool   `json:"available,omitempty"`
}

UpdateInfo stores the cached result of the latest release lookup.

func CheckForUpdate added in v1.1.1

func CheckForUpdate(parentCtx context.Context) *UpdateInfo

CheckForUpdate checks the latest GitHub release and caches the result for the current process.

type V

type V struct {
	Version        string `json:"version"`
	Commit         string `json:"commit"`
	BuildDate      string `json:"buildDate"`
	InstallMethod  string `json:"installMethod,omitempty"`
	LatestVersion  string `json:"latestVersion,omitempty"`
	UpgradeCommand string `json:"upgradeCommand,omitempty"`
}

V Version JSON struct

func GetDetailedVersion added in v1.1.1

func GetDetailedVersion(ctx context.Context) V

GetDetailedVersion returns version metadata plus update information.

func GetVersion

func GetVersion() V

GetVersion returns the version information

func (V) DisplayVersion added in v1.1.1

func (v V) DisplayVersion() string

DisplayVersion returns a human-readable version string.

func (V) LogString added in v1.1.1

func (v V) LogString() string

LogString returns the version metadata in logfmt-friendly form.

func (V) String

func (v V) String() string

String returns the version information as a string

func (V) UserAgent

func (v V) UserAgent() string

UserAgent returns the user agent string

Jump to

Keyboard shortcuts

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