update

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncCheck

func AsyncCheck(current string, timeout time.Duration) <-chan CheckResult

AsyncCheck runs a version check in the background. The returned channel receives the result when done. The check respects the given timeout.

func BinaryURL

func BinaryURL(version string) string

BinaryURL returns the download URL for a given version, OS, and architecture.

func BinaryURLFor

func BinaryURLFor(version, goos, goarch string) string

BinaryURLFor returns the download URL for a given version with explicit OS/arch. Useful for testing.

func DownloadAndReplace

func DownloadAndReplace(url string) error

DownloadAndReplace downloads the binary from url and replaces the current executable.

func GetLatestVersion

func GetLatestVersion() (string, error)

GetLatestVersion fetches the latest release tag from GitHub. Returns the version string without a leading "v" (e.g. "3.3.0").

func IsNewer

func IsNewer(current, latest string) bool

IsNewer returns true if latest is a newer semver than current. Returns false if either version is unparseable (e.g. "dev").

func PromptViaTmux

func PromptViaTmux(containerCmd, containerName, currentVersion, latestVersion string) (bool, error)

PromptViaTmux shows a tmux popup inside a container asking if the user wants to update. containerCmd is "podman" or "docker", containerName is the running container's name. Returns true if the user approved.

func RunUpdatePopup

func RunUpdatePopup(containerCmd, containerName, currentVersion string, wantUpdate *atomic.Int32, latestVersion *atomic.Value)

RunUpdatePopup starts a background goroutine that checks for updates and, if one is available, waits for the container's tmux to be ready then shows a popup. If the user approves, wantUpdate is set to 1 atomically. latestVersion is written when an update is found, regardless of approval.

Types

type CheckResult

type CheckResult struct {
	Available bool
	Latest    string
}

CheckResult holds the result of an async update check.

Jump to

Keyboard shortcuts

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