Documentation
¶
Overview ¶
Package version contains the version information for the CLI
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version injected at build time Version = "local" // Commit injected at build time Commit = "unknown" // BuildDate injected at build time BuildDate = "unknown" )
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
GetDetailedVersion returns version metadata plus update information.
func (V) DisplayVersion ¶ added in v1.1.1
DisplayVersion returns a human-readable version string.