Alert if there is a new version

Co-Authored-By: Josh Abernathy <joshaber@gmail.com>
This commit is contained in:
Corey Johnson 2019-11-20 11:18:45 -08:00
parent 817b154705
commit bc9b22d336

View file

@ -7,6 +7,7 @@ import (
"net/http"
"os"
"github.com/github/gh-cli/utils"
"github.com/mattn/go-isatty"
)
@ -20,7 +21,13 @@ func CheckForUpdate() error {
return err
}
fmt.Printf("🌭 %+v %+v\n", latestVersion, Version)
updateAvailable := latestVersion != Version
if updateAvailable {
fmt.Printf(utils.Cyan(`
New version of gh is available! %s %s
Changelog: https://github.com/github/homebrew-gh/releases/tag/%[2]s
Run 'brew upgrade github/gh/gh' to update!`)+"\n\n", Version, latestVersion)
}
return nil
}