Documentation
¶
Index ¶
- Variables
- func MarkUpdateNotificationPrinted() error
- func RenderUpdateNotification(latestVersion string, buildVersion string) string
- func ShouldCheckForUpdate(version string, args []string) bool
- func ShouldNotify(release *ReleaseInfo, binaryPath string) bool
- func ShouldPrintUpdateHint() bool
- type CheckHandle
- type CheckResult
- type ReleaseInfo
- type UpdateNotification
Constants ¶
This section is empty.
Variables ¶
var ErrNoCacheFile = errors.New("no update cache file")
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 ShouldCheckForUpdate ¶
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.