MCPcopy Index your code
hub / github.com/cli/cli / checkForUpdate

Function checkForUpdate

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

Source from the content-addressed store, hash-verified

315}
316
317func checkForUpdate(ctx context.Context, f *cmdutil.Factory, currentVersion string) (*update.ReleaseInfo, error) {
318 if updaterEnabled == "" || !update.ShouldCheckForUpdate() {
319 return nil, nil
320 }
321 httpClient, err := f.HttpClient()
322 if err != nil {
323 return nil, err
324 }
325 stateFilePath := filepath.Join(config.StateDir(), "state.yml")
326 return update.CheckForUpdate(ctx, httpClient, stateFilePath, updaterEnabled, currentVersion)
327}
328
329func isRecentRelease(publishedAt time.Time) bool {
330 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