Documentation
¶
Overview ¶
Package version implements the 'eng version' command, which displays the application's version information and checks for available updates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Version holds the application's version string (e.g., "0.1.0" or "dev"). Version = "dev" // Commit holds the Git commit hash from which the application was built. Commit = "none" // Date holds the build date of the application. Date = "unknown" )
Build-time variables These variables are populated during the build process using ldflags.
View Source
var VersionCmd = &cobra.Command{ Use: "version", Short: "Print the version number of eng and check for updates", Long: `Displays the application's version, build commit, build date, Go version, and target OS/Architecture. It also checks the GitHub repository (eng618/eng) for the latest official release and compares it with the currently running version. If a newer version is available and eng was installed via Homebrew, you can use the --update flag to attempt an automatic upgrade.`, Run: func(cmd *cobra.Command, _args []string) { isVerbose, _ := cmd.Flags().GetBool("verbose") printVersionInfo() sp := utils.NewSpinner("Checking for latest version...") sp.Start() latestRelease, err := getLatestRelease(githubRepoOwner, githubRepoName, isVerbose) sp.Stop() if err != nil { log.Warn("Could not check for updates: %v", err) return } if latestRelease == nil || latestRelease.TagName == "" { log.Warn("Could not determine the latest release version from GitHub.") return } if Version == "dev" { handleDevVersion(latestRelease) return } currentSemVer, latestSemVer, err := parseVersions(Version, latestRelease.TagName) if err != nil { log.Info("Latest release is %s: %s", latestRelease.TagName, latestRelease.HTMLURL) return } compareAndHandleUpdate(currentSemVer, latestSemVer, latestRelease, isVerbose) }, }
VersionCmd represents the Cobra command for 'eng version'. It displays the current version details and checks GitHub for the latest release. Includes an optional --update flag to attempt an update via Homebrew.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.