update

package
v0.1.30549 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugVersion

func DebugVersion(opts *Options) string

DebugVersion returns a nicely formatted string representing the state of the current version. Intended to be printed to standard error for developers.

func HowToUpdate

func HowToUpdate(opts *Options) string

HowToUpdate returns a message teaching the user how to update to the latest version.

func InstallLatest

func InstallLatest(opts *Options) (string, error)

InstallLatest will execute the updater and replace the current CLI with the latest version available.

func IsLatestVersion

func IsLatestVersion(opts *Options) bool

IsLatestVersion will tell us if the current version is the latest version available

func ParseHomebrewVersion added in v0.1.15528

func ParseHomebrewVersion(homebrewVesion string) (semver.Version, error)

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

func ReportVersion(opts *Options) string

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

func CheckForUpdates(githubAPI, slug, current, packageManager string) (*Options, error)

CheckForUpdates will check for updates given the proper package manager

Jump to

Keyboard shortcuts

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