update

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepoOwner = "aarondpn"
	RepoName  = "redmine-cli"

	ReleaseURL = "https://api.github.com/repos/" + RepoOwner + "/" + RepoName + "/releases/latest"
)

Variables

This section is empty.

Functions

func IsNewer added in v1.12.0

func IsNewer(a, b string) bool

IsNewer returns true if version a is newer than version b. Versions are expected as "major.minor.patch" (no "v" prefix).

func NewCmdUpdate

func NewCmdUpdate(version string) *cobra.Command

NewCmdUpdate creates the update command.

func ParseVersion added in v1.12.0

func ParseVersion(v string) [3]int

ParseVersion parses a semver string into [major, minor, patch].

func PrintNotice added in v1.12.0

func PrintNotice(w io.Writer, currentVersion string, result *CheckResult)

PrintNotice writes an update notice to w.

func ShouldCheck added in v1.12.0

func ShouldCheck(version string, args []string) bool

ShouldCheck returns true if the background update check should run.

Types

type CheckResult added in v1.12.0

type CheckResult struct {
	NewVersion string // e.g. "1.3.0" (without "v" prefix)
	ReleaseURL string // full GitHub release page URL
}

CheckResult holds the outcome of a background update check.

func CheckForUpdate added in v1.12.0

func CheckForUpdate(ctx context.Context, currentVersion string) *CheckResult

CheckForUpdate checks GitHub for a newer release. It returns nil on any error or if the current version is already up to date.

type GithubAsset added in v1.12.0

type GithubAsset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

GithubAsset represents a release asset.

type GithubRelease added in v1.12.0

type GithubRelease struct {
	TagName string        `json:"tag_name"`
	Assets  []GithubAsset `json:"assets"`
}

GithubRelease represents a GitHub release.

func FetchLatestRelease added in v1.12.0

func FetchLatestRelease(ctx context.Context) (*GithubRelease, error)

FetchLatestRelease fetches the latest release from GitHub.

Jump to

Keyboard shortcuts

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