autoupdate

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ChannelEnvVar = "DCLI_AUTO_UPDATE_CHANNEL"

ChannelEnvVar selects which GitHub Releases channel the startup updater considers. stable (default): GitHub "latest" non-prerelease only. prerelease: newest semver among GitHub prereleases with a matching asset. beta / alpha: like prerelease but tag must contain "-beta" or "-alpha" (case-insensitive).

View Source
const DisableEnvVar = "DCLI_DISABLE_AUTO_UPDATE"
View Source
const TimeoutEnvVar = "DCLI_AUTO_UPDATE_TIMEOUT"

Variables

View Source
var ErrReleaseNotFound = errors.New("latest release not found")

Functions

This section is empty.

Types

type Client

type Client interface {
	LatestRelease(ctx context.Context, repository Repository, channel ReleaseChannel) (*Release, error)
	UpdateTo(ctx context.Context, release *Release, executable string) error
}

type GitHubClient

type GitHubClient struct {
	BaseURL    string
	HTTPClient *http.Client
}

func NewGitHubClient

func NewGitHubClient() *GitHubClient

func (*GitHubClient) LatestRelease

func (c *GitHubClient) LatestRelease(ctx context.Context, repository Repository, channel ReleaseChannel) (*Release, error)

func (*GitHubClient) UpdateTo

func (c *GitHubClient) UpdateTo(ctx context.Context, release *Release, executable string) error

type Release

type Release struct {
	Version   string
	AssetURL  string
	AssetName string
}

type ReleaseChannel

type ReleaseChannel string

ReleaseChannel controls which GitHub releases auto-update may install.

const (
	ChannelStable     ReleaseChannel = "stable"
	ChannelPrerelease ReleaseChannel = "prerelease"
	ChannelBeta       ReleaseChannel = "beta"
	ChannelAlpha      ReleaseChannel = "alpha"
)

type Repository

type Repository struct {
	Owner string
	Name  string
}

type Runner

type Runner struct {
	Client         Client
	Repository     Repository
	ReleaseChannel ReleaseChannel
	DisableEnvVar  string
	Timeout        time.Duration
	Executable     func() (string, error)
	Environment    func() []string
	Restart        func(exe string, args []string, env []string) error
}

func NewRunner

func NewRunner(repository Repository) *Runner

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, currentVersion string, args []string)

Jump to

Keyboard shortcuts

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