MCPcopy Create free account
hub / github.com/nhost/nhost / checkCLIVersion

Function checkCLIVersion

cli/cmd/software/version.go:27–58  ·  view source on GitHub ↗
(
	ctx context.Context,
	ce *clienv.CliEnv,
	curVersion string,
)

Source from the content-addressed store, hash-verified

25}
26
27func checkCLIVersion(
28 ctx context.Context,
29 ce *clienv.CliEnv,
30 curVersion string,
31) error {
32 mgr := software.NewManager()
33
34 releases, err := mgr.GetReleases(ctx, curVersion)
35 if err != nil {
36 return fmt.Errorf("failed to get releases: %w", err)
37 }
38
39 if len(releases) == 0 {
40 ce.Infoln(
41 "✅ Nhost CLI %s for %s-%s is already on the latest version",
42 curVersion, runtime.GOOS, runtime.GOARCH,
43 )
44
45 return nil
46 }
47
48 latest := releases[0]
49 if latest.TagName == curVersion {
50 return nil
51 }
52
53 ce.Warnln("🟡 A new version of Nhost CLI is available: %s", latest.TagName)
54 ce.Println(" You can upgrade the CLI by running `nhost sw upgrade`")
55 ce.Println(" More info: https://github.com/nhost/nhost/cli/releases")
56
57 return nil
58}
59
60func checkServiceVersion(
61 ce *clienv.CliEnv,

Callers 1

CheckVersionsFunction · 0.85

Calls 6

GetReleasesMethod · 0.95
NewManagerFunction · 0.92
ErrorfMethod · 0.80
InfolnMethod · 0.80
WarnlnMethod · 0.80
PrintlnMethod · 0.80

Tested by

no test coverage detected