version

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package version handles version checks and update notifications.

Index

Constants

View Source
const (
	// GitHubReleaseURL is the URL for checking the latest release
	GitHubReleaseURL = "https://api.github.com/repos/bral/git-sweep-go/releases/latest"
	// DayInSeconds is the number of seconds in a day (for version check interval)
	DayInSeconds = 86400
)

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, currentVersion string, cfg *config.Config) (bool, string, string, error)

Check checks if a new version is available and returns information about the update It follows these steps: 1. Checks if 24 hours have passed since last check 2. If so, queries GitHub API for latest version 3. Compares with current version 4. Updates config with check time and latest version 5. Returns information about available updates

func GetVersionFromBuildInfo added in v0.8.1

func GetVersionFromBuildInfo(currentVersion string) string

GetVersionFromBuildInfo returns the version extracted from build info if available This is useful when running with go install where ldflags might not be set

func ShowUpdateNotification

func ShowUpdateNotification(currentVersion, latestVersion, releaseURL string)

ShowUpdateNotification displays a notification about an available update

Types

type GitHubRelease

type GitHubRelease struct {
	TagName string `json:"tag_name"`
	HTMLURL string `json:"html_url"`
}

GitHubRelease represents the GitHub API response for releases

Jump to

Keyboard shortcuts

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