update

package
v0.162.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package update is checking for a new version of Pscale and informs the user to update. Most of the logic is copied from cli/cli: https://github.com/cli/cli/blob/trunk/internal/update/update.go and updated to our own needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReleaseInfo

type ReleaseInfo struct {
	Version     string    `json:"tag_name"`
	URL         string    `json:"html_url"`
	PublishedAt time.Time `json:"published_at"`
}

ReleaseInfo stores information about a release

type StateEntry

type StateEntry struct {
	CheckedForUpdateAt time.Time   `yaml:"checked_for_update_at"`
	LatestRelease      ReleaseInfo `yaml:"latest_release"`
}

StateEntry stores the information we have checked for a new version. It's used to decide whether to check for a new version or not.

type UpdateInfo

type UpdateInfo struct {
	Update      bool
	Reason      string
	ReleaseInfo *ReleaseInfo
}

func CheckVersion

func CheckVersion(ctx context.Context, buildVersion string) (*UpdateInfo, error)

CheckVersion checks for the given build version whether there is a new version of the CLI or not.

func (*UpdateInfo) PrintUpdateHint added in v0.150.0

func (ui *UpdateInfo) PrintUpdateHint(buildVersion string)

Jump to

Keyboard shortcuts

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