update

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package update provides automatic update functionality for GitHubby

Package update provides automatic update functionality for GitHubby

Index

Constants

View Source
const (
	// RepoOwner is the GitHub repository owner
	RepoOwner = "Didstopia"
	// RepoName is the GitHub repository name
	RepoName = "githubby"
	// ExecutableName is the name of the executable in the release archive.
	// This allows renamed binaries (e.g., "githubby-test") to still update correctly.
	ExecutableName = "githubby"
)

Variables

This section is empty.

Functions

func FormatUpdateNotification

func FormatUpdateNotification(result *Result) string

FormatUpdateNotification returns a formatted string for the update notification

func GetPlatform

func GetPlatform() string

GetPlatform returns the current platform string (os/arch)

func IsDev added in v1.0.4

func IsDev(version string) bool

IsDev returns true if this is a development build that should skip updates

func Restart added in v1.0.4

func Restart() error

Restart replaces the current process with a new instance of the application. On Unix systems, this uses syscall.Exec() for seamless replacement. On Windows, this spawns a new process then exits the current one. Returns an error if the restart fails.

Types

type Result

type Result struct {
	// CurrentVersion is the currently running version
	CurrentVersion string
	// LatestVersion is the latest available version
	LatestVersion string
	// Available indicates if an update is available
	Available bool
	// ReleaseURL is the URL to the release page
	ReleaseURL string
	// ReleaseNotes contains the release notes (if available)
	ReleaseNotes string
}

Result contains information about an available update

func CheckForUpdate

func CheckForUpdate(ctx context.Context, currentVersion string) (*Result, error)

CheckForUpdate is a convenience function that creates an Updater and checks for updates

func Update

func Update(ctx context.Context, currentVersion string) (*Result, error)

Update is a convenience function that creates an Updater and performs an update

type Updater

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

Updater handles checking and performing updates

func NewUpdater

func NewUpdater(currentVersion string) *Updater

NewUpdater creates a new Updater instance

func (*Updater) CheckForUpdate

func (u *Updater) CheckForUpdate(ctx context.Context) (*Result, error)

CheckForUpdate checks if a new version is available

func (*Updater) Update

func (u *Updater) Update(ctx context.Context) (*Result, error)

Update downloads and installs the latest version. This uses a custom extraction that looks for ExecutableName ("githubby") in the archive, allowing renamed binaries (e.g., "githubby-test") to still update correctly.

Jump to

Keyboard shortcuts

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