update

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCacheFile = errors.New("no update cache file")
View Source
var ErrNoUpdateAvailable = errors.New("no update available")

Functions

func MarkUpdateNotificationPrinted

func MarkUpdateNotificationPrinted() error

MarkUpdateNotificationPrinted records that the detailed CLI notification was actually shown to the user.

func RenderUpdateNotification

func RenderUpdateNotification(latestVersion string, buildVersion string) string

func ShouldCheckForUpdate

func ShouldCheckForUpdate(version string, args []string) bool

ShouldCheckForUpdate decides whether the CLI checks for updates based on user preferences and execution context.

func ShouldNotify

func ShouldNotify(release *ReleaseInfo, binaryPath string) bool

ShouldNotify returns false for Homebrew users until a newly released version is likely available through Homebrew.

func ShouldPrintUpdateHint

func ShouldPrintUpdateHint() bool

ShouldPrintUpdateHint reports whether the CLI notification may be printed after command execution.

Types

type CheckHandle

type CheckHandle struct {
	// contains filtered or unexported fields
}

CheckHandle allows the root command and a TUI to await the same result.

func NewCheckHandle

func NewCheckHandle() *CheckHandle

func (*CheckHandle) Complete

func (h *CheckHandle) Complete(result CheckResult)

func (*CheckHandle) Wait

func (h *CheckHandle) Wait(ctx context.Context) CheckResult

type CheckResult

type CheckResult struct {
	Release *ReleaseInfo
	Err     error
}

type ReleaseInfo

type ReleaseInfo struct {
	Version     string    `json:"version"`
	PublishedAt time.Time `json:"published_at"`
	FetchedAt   time.Time `json:"fetched_at"`
}

func CheckForUpdate

func CheckForUpdate(ctx context.Context, buildVersion string, client *http.Client) (*ReleaseInfo, error)

CheckForUpdate checks if a newer version is available. Returns the release information or ErrNoUpdateAvailable.

func (ReleaseInfo) IsFetchedWithin

func (r ReleaseInfo) IsFetchedWithin(interval time.Duration) bool

func (ReleaseInfo) IsRecent

func (r ReleaseInfo) IsRecent() bool

IsRecent checks if the release was published within the last 24 hours.

type UpdateNotification

type UpdateNotification struct {
	LastPrintedAt time.Time `json:"last_printed_at"`
}

Jump to

Keyboard shortcuts

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