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

Function checkServiceVersion

cli/cmd/software/version.go:60–86  ·  view source on GitHub ↗
(
	ce *clienv.CliEnv,
	software graphql.SoftwareTypeEnum,
	curVersion string,
	availableVersions *graphql.GetSoftwareVersions,
	changelog string,
)

Source from the content-addressed store, hash-verified

58}
59
60func checkServiceVersion(
61 ce *clienv.CliEnv,
62 software graphql.SoftwareTypeEnum,
63 curVersion string,
64 availableVersions *graphql.GetSoftwareVersions,
65 changelog string,
66) {
67 recommendedVersions := make([]string, 0, 5) //nolint:mnd
68
69 for _, v := range availableVersions.GetSoftwareVersions() {
70 if *v.GetSoftware() == software && v.GetVersion() == curVersion {
71 ce.Infoln("✅ %s is already on a recommended version: %s", software, curVersion)
72 return
73 } else if *v.GetSoftware() == software {
74 recommendedVersions = append(recommendedVersions, v.GetVersion())
75 }
76 }
77
78 ce.Warnln(
79 "🟡 %s is not on a recommended version. Recommended: %s",
80 software, strings.Join(recommendedVersions, ", "),
81 )
82
83 if changelog != "" {
84 ce.Println(" More info: %s", changelog)
85 }
86}
87
88func CheckVersions(
89 ctx context.Context,

Callers 1

CheckVersionsFunction · 0.85

Calls 6

GetSoftwareMethod · 0.80
InfolnMethod · 0.80
WarnlnMethod · 0.80
PrintlnMethod · 0.80
GetVersionMethod · 0.65
GetSoftwareVersionsMethod · 0.45

Tested by

no test coverage detected