updatecheck

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package updatecheck surfaces a soft "newer version available" notice when ketch is run interactively. It caches release metadata locally so the network check happens at most once per day, and the hint only appears when the cached status is recent.

Respect: KETCH_NO_UPDATE_NOTIFIER=1 disables everything; the CI env var also suppresses notices automatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disabled

func Disabled() bool

Disabled reports whether the user has opted out of update checks.

func FormatNotice

func FormatNotice(status Status) string

FormatNotice renders the short two-line reminder printed to stderr.

func MarkNotified

func MarkNotified(status Status) error

MarkNotified records that the user has been shown the current status.

func ShouldNotify

func ShouldNotify(status Status) bool

ShouldNotify reports whether the passive notice should be shown. The notice is suppressed if the same version was already announced within the notifyTTL window.

Types

type InstallType

type InstallType string
const (
	InstallUnknown  InstallType = "unknown"
	InstallHomebrew InstallType = "homebrew"
	InstallGo       InstallType = "go"
	InstallManual   InstallType = "manual"
)

type Options

type Options struct {
	CurrentVersion string
	AllowNetwork   bool
	Timeout        time.Duration
}

type Status

type Status struct {
	CheckedAt     time.Time   `json:"checked_at,omitempty"`
	CacheStale    bool        `json:"cache_stale"`
	Available     bool        `json:"available"`
	LatestVersion string      `json:"latest_version,omitempty"`
	InstallType   InstallType `json:"install_type,omitempty"`
	Command       string      `json:"command,omitempty"`
	ReleaseURL    string      `json:"release_url,omitempty"`
	Source        string      `json:"source,omitempty"`
}

func GetStatus

func GetStatus(ctx context.Context, opts Options) (Status, error)

GetStatus returns the cached or freshly-fetched update status. AllowNetwork=false forces cache-only mode.

Jump to

Keyboard shortcuts

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