MCPcopy
hub / github.com/kopia/kopia / maybePrintUpdateNotification

Method maybePrintUpdateNotification

cli/update_check.go:235–253  ·  view source on GitHub ↗

maybePrintUpdateNotification prints notification about available version.

(ctx context.Context)

Source from the content-addressed store, hash-verified

233
234// maybePrintUpdateNotification prints notification about available version.
235func (c *App) maybePrintUpdateNotification(ctx context.Context) {
236 if repo.BuildGitHubRepo == "" {
237 // not built from GH repo.
238 return
239 }
240
241 updatedVersion, err := c.maybeCheckForUpdates(ctx)
242 if err != nil {
243 log(ctx).Debugf("unable to check for updates: %v", err)
244 return
245 }
246
247 if updatedVersion == "" {
248 log(ctx).Debug("no updated version available")
249 return
250 }
251
252 log(ctx).Infof(updateAvailableNoticeFormat, ensureVPrefix(repo.BuildVersion), ensureVPrefix(updatedVersion), repo.BuildGitHubRepo)
253}
254
255func ensureVPrefix(s string) string {
256 if strings.HasPrefix(s, "v") {

Callers 1

openRepositoryMethod · 0.95

Calls 2

maybeCheckForUpdatesMethod · 0.95
ensureVPrefixFunction · 0.85

Tested by

no test coverage detected