Documentation
¶
Overview ¶
Package update provides CLI self-update functionality for BlueFunda CLIs. It detects the installation method (Homebrew, dpkg, rpm, or standalone binary) and performs the upgrade using the appropriate strategy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BinaryUpgrader ¶
type BinaryUpgrader struct{}
BinaryUpgrader downloads the archive from GitHub Releases, verifies SHA256, extracts the binary and replaces the current executable in place.
func (*BinaryUpgrader) Name ¶
func (b *BinaryUpgrader) Name() string
type BrewUpgrader ¶
type BrewUpgrader struct {
Cask string
}
BrewUpgrader upgrades via `brew upgrade --cask <cask>`.
func (*BrewUpgrader) Name ¶
func (b *BrewUpgrader) Name() string
type Config ¶
type Config struct {
// BinaryName is the CLI binary name, e.g. "bai", "abaper", "breq".
BinaryName string
// CurrentVersion is the version string injected at build time via ldflags.
// May be "dev", "v1.2.3", or "1.2.3".
CurrentVersion string
// GitHubOwner is the GitHub organisation, e.g. "bluefunda".
GitHubOwner string
// GitHubRepo is the GitHub repository name, e.g. "bluefunda-ai".
GitHubRepo string
// HomebrewTap is the tap name, e.g. "bluefunda/tap". When set, the tap
// is trusted before upgrade so Homebrew 4.x loads the formula without
// requiring the user to run `brew trust` manually.
HomebrewTap string
// HomebrewCask is the formula or cask name in the tap, e.g. "bai".
HomebrewCask string
}
Config holds per-CLI settings for the update command.
type DpkgUpgrader ¶
type DpkgUpgrader struct{}
DpkgUpgrader downloads the .deb from GitHub Releases and installs it with dpkg.
func (*DpkgUpgrader) Name ¶
func (d *DpkgUpgrader) Name() string
type RpmUpgrader ¶
type RpmUpgrader struct{}
RpmUpgrader downloads the .rpm from GitHub Releases and installs it with rpm.
func (*RpmUpgrader) Name ¶
func (r *RpmUpgrader) Name() string
type Upgrader ¶
type Upgrader interface {
// Name returns the human-readable name of the upgrade strategy.
Name() string
// Upgrade downloads and installs the given version.
// version is the plain semver string without "v" prefix (e.g. "1.5.0").
Upgrade(cfg Config, version string) error
}
Upgrader performs the actual CLI upgrade.