cli

package
v0.96.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const NewRelicCLILatestReleaseURL string = "https://download.newrelic.com/install/newrelic-cli/currentVersion.txt"

NewRelicCLILatestReleaseURL is the URL used to fetch the latest release data utilizing GitHub's API.

View Source
const UpdateVersionMsgFormat string = `` /* 194-byte string literal not displayed */

UpdateVersionMsgFormat is the message displayed to a user when an older version of the CLI is installed.

Variables

This section is empty.

Functions

func FormatUpdateVersionMessage

func FormatUpdateVersionMessage(latestReleaseVersion string) string

func GetLatestReleaseVersion

func GetLatestReleaseVersion(ctx context.Context) (string, error)

GetLatestReleaseVersion returns the latest released tag. The latest tag is pulled from the newrelic-cli GitHub repository.

func IsDevEnvironment

func IsDevEnvironment() bool

IsDevEnvironment is a naive implementation to determine if the CLI is being run in a dev environment. IsDevEnvironment returns true when the installed CLI version is either in a prerelease state or in a dirty state. The version string is generated at compile time using git. The prerelease string is appended to the primary semver version string.

If you're doing local development on the CLI, your version may look similar to the examples below.

Examples of versions that have a prerelease tag (i.e. the suffix):

v0.32.1-10-gbe63a24
v0.32.1-10-gbe63a24-dirty

In this example version string, "10" represents the number of commits since the 0.32.1 tag was created. The "gbe63a24" is the previous commit's abbreviated sha. The "dirty" part means that git was in a dirty state at compile time, meaning an updated file was saved, but not yet committed.

func IsLatestVersion

func IsLatestVersion(ctx context.Context, latestVersion string) (bool, error)

IsLatestVersion returns true if the provided version string matches the current installed version.

func PrintUpdateCLIMessage

func PrintUpdateCLIMessage(latestReleaseVersion string)

func Version

func Version() string

Version returns the version of the CLI that's currently installed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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