Documentation
¶
Index ¶
- func AsyncCheck(current string, timeout time.Duration) <-chan CheckResult
- func BinaryURL(version string) string
- func BinaryURLFor(version, goos, goarch string) string
- func DownloadAndReplace(url string) error
- func GetLatestVersion() (string, error)
- func IsNewer(current, latest string) bool
- func PromptViaTmux(containerCmd, containerName, currentVersion, latestVersion string) (bool, error)
- func RunUpdatePopup(containerCmd, containerName, currentVersion string, wantUpdate *atomic.Int32, ...)
- type CheckResult
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 BinaryURLFor ¶
BinaryURLFor returns the download URL for a given version with explicit OS/arch. Useful for testing.
func DownloadAndReplace ¶
DownloadAndReplace downloads the binary from url and replaces the current executable.
func GetLatestVersion ¶
GetLatestVersion fetches the latest release tag from GitHub. Returns the version string without a leading "v" (e.g. "3.3.0").
func IsNewer ¶
IsNewer returns true if latest is a newer semver than current. Returns false if either version is unparseable (e.g. "dev").
func PromptViaTmux ¶
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 ¶
CheckResult holds the result of an async update check.