Documentation
¶
Overview ¶
Package cliinstall carries the fleet's compiled-in catalog of installable CLIs (cli-install#req:catalog-compiled-in): a stable id per CLI, its release identity in the github.com/strongo/cli-helpers/selfupdate Config shape, its Homebrew cask coordinates, and the host -> target relevance texts a fleet CLI shows when it lists or explains its siblings.
Identity lives here, once ¶
Every per-CLI identity constructor — repository, tag prefix, managers, supported platforms, asset and checksum naming, version-probe arguments — lives in this package as an Entry, never in selfupdate itself (cli-install#req:catalog-identity-single-source). A host builds its own self-update Config from its own Entry.Config, so its self-update and every other host's "install <that cli>" resolve releases identically. This couples a CLI's release naming to a cli-helpers release: a CLI that changes its GoReleaser archive or checksum naming must first update its catalog entry here.
What this package does not do ¶
cliinstall carries data and validates it against recorded snapshots (see the gen subpackage and TestCatalog*); it does not locate installed binaries, plan a destination, or install anything. Those are later pieces of the cli-install Feature, built on top of this catalog.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
// ID is the catalog id, equal to the binary name
// (cli-install#req:host-identity-from-catalog).
ID string
// Homepage is the CLI's canonical homepage URL.
Homepage string
// Description is a one-line description shown in a listing row.
Description string
// Details is a longer description of at most a few short paragraphs,
// shown before a confirmation prompt
// (cli-install#req:details-before-install).
Details string
// Repository is "owner/repo" on GitHub that publishes this CLI's
// releases — see selfupdate.Config.Repository.
Repository string
// TagPrefix selects this binary's releases within Repository when that
// repository publishes more than one product's releases — see
// selfupdate.Config.TagPrefix.
TagPrefix string
// Managers are the package managers that might own this binary's
// install, exactly as this CLI's own self-update declares them — see
// selfupdate.Config.Managers.
Managers []selfupdate.Manager
// SupportedPlatforms restricts install and self-replace to the
// GOOS/GOARCH pairs this CLI's release actually publishes — see
// selfupdate.Config.SupportedPlatforms.
SupportedPlatforms []selfupdate.Platform
// VersionProbeArgs are the arguments run against a newly installed copy
// to confirm its version. A zero value leaves selfupdate.Config's own
// default ({"--version"}) in effect.
VersionProbeArgs []string
// UndeterminedVersions lists the CurrentVersion values that mean "this
// build cannot say its own version". A zero value leaves
// selfupdate.Config's own default ({"dev"}) in effect.
UndeterminedVersions []string
// AssetName names this CLI's release archive for one version/platform
// combination. Nil leaves selfupdate.Config's GoReleaser-shaped default
// in effect, which every catalog entry's archive naming matches.
AssetName func(binary, version, goos, goarch string) string
// ChecksumsName names this CLI's release checksums file for one
// version. Nil leaves selfupdate.Config's GoReleaser-shaped default
// ("<binary>_<version>_checksums.txt") in effect; some CLIs publish a
// single flat "checksums.txt" instead and override this.
ChecksumsName func(binary, version string) string
// CaskToken is the argument to `brew install --cask`, tap-qualified
// (e.g. "sneat-dev/tap/wb"). Empty means this CLI publishes no
// Homebrew cask.
CaskToken string
// CaskOS lists the GOOS values ("darwin", "linux") CaskToken's cask
// supports. Empty when CaskToken is empty.
CaskOS []string
// LegacyVersionSignatures optionally lists bare `--version` output
// patterns that identify an old build of this CLI, for the
// status-probe-order fallback step
// (cli-install#req:status-probe-order). Empty when no such pattern is
// declared for this CLI.
LegacyVersionSignatures []string
}
Entry is one compiled-in catalog record: a fleet CLI's stable identity, its release identity in the Self-Update Library's Config shape, its Homebrew cask coordinates, and the descriptive text a host shows a user before installing it (cli-install#req:catalog-entry-identity).
func ByID ¶
ByID returns the catalog entry for id and whether it was found (cli-install#req:host-identity-from-catalog).
func Entries ¶
func Entries() []Entry
Entries returns every catalog entry, sorted by id, as a defensive copy — mutating the returned slice or its elements' slice/func fields never affects the compiled-in catalog.
func (Entry) Config ¶
func (e Entry) Config(currentVersion string) selfupdate.Config
Config returns e's release identity as a selfupdate.Config for a build currently reporting currentVersion (cli-install#req:catalog-identity- single-source). It reproduces e's fields exactly; a caller that needs something only its own self-update requires (an AfterUpdate hook, for instance, which is a cobracmd.CommandOptions field, not a Config one) adds it outside this method.
type Relevance ¶
type Relevance struct {
// Target is the relevant CLI's catalog id.
Target string
// Text is the relevance text written for this exact host/target pair.
Text string
}
Relevance is one host -> target row of the catalog's relevance matrix (cli-install#req:relevance-matrix): why a user of the host would want the target.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Command gen records, under cliinstall/testdata/snapshots/, a snapshot of each catalog CLI's real published release asset list and (where one exists) its real Homebrew cask file.
|
Command gen records, under cliinstall/testdata/snapshots/, a snapshot of each catalog CLI's real published release asset list and (where one exists) its real Homebrew cask file. |