update

package
v0.46.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownRepo = errors.New("update repo not set")
	ErrNoRelease   = errors.New("no release available")
	ErrDevBuild    = errors.New("update disabled for dev build")
	ErrNoAsset     = errors.New("platform asset not found")
	ErrNoDigest    = errors.New("release asset has no sha256 digest")
	ErrRateLimited = errors.New("github api rate limited")
)

Functions

func DevBuild added in v0.46.1

func DevBuild(ver string) bool

Types

type Asset

type Asset struct {
	Name   string
	URL    string
	Size   int64
	Digest string // "sha256:<hex>"; empty on releases predating api digests
}

type Client

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

func NewClient

func NewClient(h *http.Client, repo string) (Client, error)

func (Client) Apply added in v0.46.1

func (c Client) Apply(ctx context.Context, res Result, exe string, prog Progress) error

func (Client) Check

func (c Client) Check(ctx context.Context, curr string, plat Platform) (Result, bool, error)

Check returns the release to install when one newer than curr exists.

func (Client) Latest

func (c Client) Latest(ctx context.Context) (Info, error)

func (Client) Ready

func (c Client) Ready() bool

Ready reports whether the client was actually built by NewClient - the UI gets it through ui.Config so a zero value slips in when the field was never set.

type Info

type Info struct {
	Version   string
	Notes     string
	Published time.Time
	Assets    []Asset
}

func (Info) Asset

func (i Info) Asset(name string) (Asset, bool)

type Platform

type Platform struct {
	OS    string
	Arch  string
	Asset string // release asset name, e.g. "resterm_Darwin_arm64"
}

func Detect

func Detect() (Platform, error)

func For

func For(goos, goarch string) (Platform, error)

type Progress added in v0.4.3

type Progress interface {
	Start(total int64)
	Advance(n int64)
	Done(err error)
}

Progress is implemented by callers that want to render download progress. Start's total is 0 when the size is unknown, and Done always fires once the download ends, with the error it failed on or nil.

type Result

type Result struct {
	Info   Info
	Bin    Asset
	Digest [sha256.Size]byte
}

Jump to

Keyboard shortcuts

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