Documentation
¶
Overview ¶
Package update provides version checking and self-update functionality for s9s.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker queries GitHub for new releases.
func NewChecker ¶
func NewChecker() *Checker
NewChecker creates a Checker for the default s9s repository.
func NewCheckerFor ¶
NewCheckerFor creates a Checker for a specific GitHub repository.
func (*Checker) LatestRelease ¶
LatestRelease fetches the latest release from GitHub. If includePreRelease is true, pre-release versions are considered.
type ReleaseInfo ¶
type ReleaseInfo struct {
Version string
TagName string
PublishedAt time.Time
PreRelease bool
HTMLURL string
Assets []Asset
}
ReleaseInfo holds information about a GitHub release.
type State ¶
type State struct {
LastChecked time.Time `json:"lastChecked"`
LatestVersion string `json:"latestVersion"`
LatestURL string `json:"latestURL"`
CurrentVersion string `json:"currentVersion"`
}
State persists update check metadata.
func LoadState ¶
func LoadState() *State
LoadState reads the update state from ~/.s9s/update-state.json. Returns an empty state (not an error) if the file is missing or corrupt.
func LoadStateFrom ¶
LoadStateFrom reads the update state from a specific directory.
func (*State) NeedsCheck ¶
NeedsCheck returns true if enough time has passed since the last check.
type UpdateOptions ¶
type UpdateOptions struct {
PreRelease bool
Force bool // skip "already up to date" check
TargetVersion string // update to a specific version (e.g. "v0.7.0"); empty = latest
}
UpdateOptions configures the self-update behavior.
type UpdateResult ¶
UpdateResult contains the outcome of an update operation.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater performs the self-update of the s9s binary.
func NewUpdater ¶
func NewUpdater() *Updater
NewUpdater creates an Updater with the current build version.
func (*Updater) Update ¶
func (u *Updater) Update(ctx context.Context, opts UpdateOptions) (*UpdateResult, error)
Update downloads and installs the latest release, replacing the running binary.