Documentation
¶
Overview ¶
Package updatecheck implements an unobtrusive "new version available" notifier for the Mercury CLI, modelled after gh/flyctl/deno.
The check runs in a background goroutine kicked off at the start of a CLI invocation. At the end of the invocation the caller joins the goroutine with a short deadline via Notify; if a strictly-newer release is known, a short banner is written to the provided writer (typically os.Stderr). A local cache keeps most invocations off the network entirely.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker is the handle returned by Start. It is safe to call Notify at most once per Checker.
type Options ¶
type Options struct {
CurrentVersion string
Args []string
VersionURL string
CachePath string
CacheTTL time.Duration
HTTPClient *http.Client
Now func() time.Time
// LookupEnv overrides os.LookupEnv, for tests.
LookupEnv func(string) (string, bool)
}
Options configures a Checker. Fields left at their zero value pick reasonable defaults; tests can override any of them.