Documentation ¶
Index ¶
- func DebugVersion(opts *Options) string
- func HowToUpdate(opts *Options) string
- func InstallLatest(opts *Options) (string, error)
- func IsLatestVersion(opts *Options) bool
- func ParseHomebrewVersion(homebrewVesion string) (semver.Version, error)
- func ReportVersion(opts *Options) string
- func ShouldCheckForUpdates(upd *settings.UpdateCheck) bool
- type HomebrewOutdated
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugVersion ¶
DebugVersion returns a nicely formatted string representing the state of the current version. Intended to be printed to standard error for developers.
func HowToUpdate ¶
HowToUpdate returns a message teaching the user how to update to the latest version.
func InstallLatest ¶
InstallLatest will execute the updater and replace the current CLI with the latest version available.
func IsLatestVersion ¶
IsLatestVersion will tell us if the current version is the latest version available
func ParseHomebrewVersion ¶ added in v0.1.15528
Homebrew revisions get added to the version with an underscore. So `1.2.3 revision 4` becomes `1.2.3_4`. This fails to parse as valid semver version. We can work around this by replacing underscores with `-` to convert the revision to a semver tag. https://github.com/CircleCI-Public/circleci-cli/issues/610
func ReportVersion ¶
ReportVersion returns a nicely formatted string representing the state of the current version. Intended to be printed to the user.
func ShouldCheckForUpdates ¶
func ShouldCheckForUpdates(upd *settings.UpdateCheck) bool
ShouldCheckForUpdates tell us if the last update check was more than a day ago
Types ¶
type HomebrewOutdated ¶
type HomebrewOutdated struct { Formulae []struct { Name string `json:"name"` InstalledVersions []string `json:"installed_versions"` CurrentVersion string `json:"current_version"` Pinned bool `json:"pinned"` PinnedVersion string `json:"pinned_version"` } `json:"formulae"` }
HomebrewOutdated wraps the JSON output from running `brew outdated --json=v2` We're specifically looking for this kind of structured data from the command:
{ "formulae": [ { "name": "circleci", "installed_versions": [ "0.1.1248" ], "current_version": "0.1.3923", "pinned": false, "pinned_version": null } ], "casks": [] }
type Options ¶
type Options struct { Current semver.Version Found bool Latest *selfupdate.Release PackageManager string // contains filtered or unexported fields }
Options contains everything we need to check for or perform updates of the CLI.
func CheckForUpdates ¶
CheckForUpdates will check for updates given the proper package manager