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

Function checkForUpdate

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

Source from the content-addressed store, hash-verified

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