update

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package update checks GitHub for newer CLI releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available added in v0.4.0

func Available(currentVersion string) string

Available returns the latest release version if one newer than currentVersion exists, else empty string. Respects the 24h cache and KONTEXT_NO_UPDATE_CHECK. Blocks for up to 3s on cache miss (HTTP fetch with 3s timeout).

func CheckAsync

func CheckAsync(currentVersion string)

CheckAsync spawns a background goroutine that checks for a newer release. It prints a one-liner to stderr if an update is available, and does nothing on any error. The check is fully fire-and-forget — it never blocks the caller.

func PrintNotification added in v0.4.0

func PrintNotification(w io.Writer, currentVersion, latestVersion string)

PrintNotification writes the passive "update available" one-liner to w.

func PromptAndUpgrade added in v0.4.0

func PromptAndUpgrade(in io.Reader, out io.Writer, currentVersion, latestVersion string) (bool, error)

PromptAndUpgrade prompts the user "Update now? y/N " on out, reads a single line from in, and on "y"/"yes" (case-insensitive) attempts to run the upgrade. Returns (true, nil) when a brew upgrade command ran successfully — the caller should exit so the user can re-invoke. Returns (false, nil) when the user declined, the install method is manual, or brew is not on PATH (in which case manual instructions are printed to out). Returns (false, err) only for truly unexpected errors (e.g. stdin read error).

Types

This section is empty.

Jump to

Keyboard shortcuts

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