MCPcopy Create free account
hub / github.com/cli/cli / checkForUpdate

Function checkForUpdate

internal/ghcmd/cmd.go:331–341  ·  view source on GitHub ↗
(ctx context.Context, f *cmdutil.Factory, currentVersion string)

Source from the content-addressed store, hash-verified

329}
330
331func checkForUpdate(ctx context.Context, f *cmdutil.Factory, currentVersion string) (*update.ReleaseInfo, error) {
332 if updaterEnabled == "" || !update.ShouldCheckForUpdate() {
333 return nil, nil
334 }
335 httpClient, err := f.HttpClient()
336 if err != nil {
337 return nil, err
338 }
339 stateFilePath := filepath.Join(config.StateDir(), "state.yml")
340 return update.CheckForUpdate(ctx, httpClient, stateFilePath, updaterEnabled, currentVersion)
341}
342
343func isRecentRelease(publishedAt time.Time) bool {
344 return !publishedAt.IsZero() && time.Since(publishedAt) < time.Hour*24

Callers 1

MainFunction · 0.85

Calls 4

ShouldCheckForUpdateFunction · 0.92
StateDirFunction · 0.92
CheckForUpdateFunction · 0.92
JoinMethod · 0.80

Tested by

no test coverage detected