update

package
v0.1.4308 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 11 Imported by: 0

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 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 {
	Name              string   `json:"name"`
	InstalledVersions []string `json:"installed_versions"`
	CurrentVersion    string   `json:"current_version"`
	Pinned            bool     `json:"pinned"`
	PinnedVersion     string   `json:"pinned_version"`
}

HomebrewOutdated wraps the JSON output from running `brew outdated --json=v1` We're specifically looking for this kind of structured data from the command:

[
  {
    "name": "circleci",
    "installed_versions": [
      "0.1.1248"
    ],
    "current_version": "0.1.3923",
    "pinned": false,
    "pinned_version": null
  },
]

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