update

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 12 Imported by: 0

README

Update Command

Updates the tool to the latest or specified version.

For detailed information on update processes and migration, see the Built-in Commands Documentation.

Documentation

Overview

Package update provides the Cobra command for self-updating the CLI binary to the latest released version from the configured release source (GitHub or GitLab), with support for private repositories via token authentication.

Index

Constants

This section is empty.

Variables

View Source
var (

	// allow mocking in tests.
	ExportExecCommand = exec.CommandContext
	ExportNewUpdater  = func(props *p.Props, version string, force bool) (Updater, error) {
		return setup.NewUpdater(props, version, force)
	}
	ExportNewOfflineUpdater = func(props *p.Props) Updater {
		return setup.NewOfflineUpdater(props.Tool, props.Logger, props.FS)
	}
)

Functions

func NewCmdUpdate

func NewCmdUpdate(props *p.Props) *cobra.Command

NewCmdUpdate creates the update command for self-updating the tool binary.

func UpdateConfig added in v1.6.0

func UpdateConfig(ctx context.Context, props *p.Props, binPath string)

UpdateConfig re-runs the init flow after a successful update to ensure config compatibility.

Types

type UpdateResult added in v1.7.0

type UpdateResult struct {
	PreviousVersion string `json:"previous_version"`
	NewVersion      string `json:"new_version"`
	Updated         bool   `json:"updated"`
}

UpdateResult contains the outcome of a successful update.

func Update

func Update(ctx context.Context, props *p.Props, version string, force bool) (*UpdateResult, error)

Update downloads and installs the specified version (or latest) of the tool.

type Updater added in v1.6.0

type Updater interface {
	GetLatestVersionString(ctx context.Context) (string, error)
	Update(ctx context.Context) (string, error)
	UpdateFromFile(filePath string) (string, error)
	GetReleaseNotes(ctx context.Context, from, to string) (string, error)
	GetCurrentVersion() string
}

Updater defines the interface for self-updating functionality.

Jump to

Keyboard shortcuts

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