Documentation ¶
Index ¶
- Constants
- func FormatUpdateVersionMessage(latestReleaseVersion string) string
- func GetLatestReleaseVersion(ctx context.Context) (string, error)
- func IsDevEnvironment() bool
- func IsLatestVersion(ctx context.Context, latestVersion string) (bool, error)
- func PrintUpdateCLIMessage(latestReleaseVersion string)
- func Version() string
Constants ¶
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.
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 GetLatestReleaseVersion ¶
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 ¶
IsLatestVersion returns true if the provided version string matches the current installed version.
func PrintUpdateCLIMessage ¶
func PrintUpdateCLIMessage(latestReleaseVersion string)
Types ¶
This section is empty.