1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Only report version check when it can be

Signed-off-by: Stoned Elipot <stoned.elipot@gmail.com>
This commit is contained in:
Stoned Elipot
2022-09-11 19:52:37 +02:00
committed by Hidde Beydals
parent 408dc0217b
commit cb1a43dfab

View File

@@ -26,11 +26,12 @@ func PrintVersion(c *cli.Context) {
outdated, err := AIsNewerThanB(upstreamVersion, Version)
if err != nil {
out += fmt.Sprintf("\n[warning] failed to compare current version with latest: %v\n", err)
}
if outdated {
out += fmt.Sprintf("\n[info] sops %s is available, update with `go get -u github.com/getsops/sops/v3/cmd/sops`\n", upstreamVersion)
} else {
out += " (latest)\n"
if outdated {
out += fmt.Sprintf("\n[info] sops %s is available, update with `go get -u github.com/getsops/sops/v3/cmd/sops`\n", upstreamVersion)
} else {
out += " (latest)\n"
}
}
}
fmt.Fprintf(c.App.Writer, "%s", out)