update

package
v1.0.46 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NancyAppName = "nancy"
	NancySlug    = "sonatype-nexus-community/" + NancyAppName
)

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 {
	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": "nancy",
      "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