autoupdate

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GithubOwner = "sleuth-io"
	GithubRepo  = "sx"
)

Variables

This section is empty.

Functions

func ApplyPendingUpdate

func ApplyPendingUpdate() bool

ApplyPendingUpdate checks for a pending update marker and applies it. This should be called at startup before CheckAndUpdateInBackground. The fast path (no marker) is a single os.Stat call. Returns true if an update was applied (caller should re-exec).

func CLIAssetFilter

func CLIAssetFilter() string

CLIAssetFilter returns a regexp matching only the GoReleaser CLI archive for the current platform, e.g. "sx_Linux_x86_64.tar.gz". It mirrors the name_template in .goreleaser.yml.

The GitHub release also carries desktop-app archives (sx-app-<os>-<arch>…) whose names would otherwise satisfy go-selfupdate's default <os><sep><arch> suffix match and get selected instead of the CLI binary — the app tar has no "sx" executable inside, so the update then fails with "executable not found in tar". Constraining asset selection to "sx_<OS>_<ARCH>" avoids that. go-selfupdate lowercases asset names before matching, so this pattern is lowercase and anchored.

func CheckAndUpdateInBackground

func CheckAndUpdateInBackground()

CheckAndUpdateInBackground checks for updates and installs them automatically if found. It only checks once per day (tracked via cache file). This function returns immediately and doesn't block.

func ClearPendingUpdate

func ClearPendingUpdate()

ClearPendingUpdate removes the pending update marker file. Call this after a successful manual update (e.g., `sx update`).

func NewUpdater

func NewUpdater() (*selfupdate.Updater, error)

NewUpdater builds a go-selfupdate Updater restricted to the CLI's own release archives via CLIAssetFilter. Shared by the background auto-updater and the `sx update` command so both select the same asset.

Types

This section is empty.

Jump to

Keyboard shortcuts

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