Documentation
¶
Overview ¶
Package update implements the CLI's update check and self-upgrade.
The check is designed to never slow a command down: the banner only reads a small cached state file, and the network refresh (at most once per 24h) runs after the command's real work has finished. BITWAVE_NO_UPDATE_CHECK=1 disables all network checks; dev/snapshot builds never check.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundRefresh ¶
func BackgroundRefresh(currentVersion string)
BackgroundRefresh refreshes the cached latest version if it is stale. Errors are deliberately swallowed: an offline machine should never see update-check noise. Intended to run after a command's real work is done.
func CachedNotice ¶
CachedNotice returns a one-line upgrade hint if the cached state knows a newer version. It never touches the network.
func Disabled ¶
Disabled reports whether update checking is off for this process: opted out via env, or a non-release build (anything with a prerelease suffix, e.g. 0.1.0-dev or 0.2.1-SNAPSHOT-abc).
Types ¶
type InstallMethod ¶
type InstallMethod string
InstallMethod classifies how the running binary was installed, from its (symlink-resolved) path.
const ( MethodNpm InstallMethod = "npm" MethodBrew InstallMethod = "brew" MethodDirect InstallMethod = "direct" )
func DetectInstallMethod ¶
func DetectInstallMethod(exePath string) InstallMethod
DetectInstallMethod classifies an executable path. Callers should pass a symlink-resolved path (Homebrew links $(brew --prefix)/bin/bitwave into the Caskroom; npm links into node_modules).