Documentation
¶
Overview ¶
Package brew self-updates a Go CLI binary through Homebrew. A tool describes itself with a Config and calls Update; it refreshes the formula, then upgrades (or taps and installs), with a stable and a dev (--HEAD) channel, and removes stray non-Homebrew copies so the brew install is authoritative. Check reports whether a newer release exists without installing anything.
It is one update mechanism under clive/update; others (e.g. a release-asset downloader) can sit alongside it. The clog dependency lives here, keeping the core clive package dependency-light for version-only consumers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Channel ¶
type Channel int
Channel selects what [Config.Run] installs.
func ChannelFor ¶
ChannelFor maps a --dev/--stable flag pair to a Channel; neither set is Upgrade.
type Config ¶
type Config struct {
// Info carries the module path and repo for version checks and release links.
Info clive.Info
// Name is the display name shown in messages, e.g. "NGINX" for the nginx
// formula. Defaults to the binary name (and thus the formula) when unset.
Name string
// Formula is the Homebrew formula name.
Formula string
// Tap is the "owner/name" tap hosting the formula; empty means a core formula.
Tap string
// TapURL is the git remote for Tap, for a private tap brew cannot resolve by
// name; empty lets brew resolve a public tap.
TapURL string
// Binary is the executable name to clean up non-brew copies of; defaults to
// Formula.
Binary string
// OnConflict decides how non-Homebrew copies of the binary on PATH are
// handled; the zero value warns that each one may shadow the brew install.
OnConflict ConflictPolicy
}
Config identifies the tool for a Homebrew self-update. Only Info, Name, and Formula are required; Tap/TapURL are needed for a formula outside homebrew/core.
func (Config) BinaryName ¶ added in v0.0.9
BinaryName is the executable/command name, defaulting to the formula. Shared by other update mechanisms (the periodic check) that name the `<binary> update` command.
func (Config) DisplayName ¶ added in v0.0.9
DisplayName is the human-facing name used in messages, defaulting to the binary (and thus the formula) name when Name is unset.
type ConflictPolicy ¶ added in v0.0.11
type ConflictPolicy int
ConflictPolicy decides what an update does with copies of the binary found on PATH outside Homebrew, which would otherwise shadow the brew install.
const ( // ConflictWarn leaves stray non-Homebrew copies in place but warns about each // one. It is the zero value, and thus the default. ConflictWarn ConflictPolicy = iota // ConflictUninstall removes stray copies so the brew install is authoritative. ConflictUninstall // ConflictIgnore leaves stray copies in place silently. ConflictIgnore )