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 ¶
NewCmdUpdate creates the update command for self-updating the tool binary.
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.
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.
Click to show internal directories.
Click to hide internal directories.