MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / runUpdate

Function runUpdate

cmd/update.go:55–73  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

53}
54
55func runUpdate(cmd *cobra.Command, args []string) {
56 status, err := checkForUpdate()
57 if err != nil {
58 fatal(fmt.Sprintf("Error checking for updates: %v", err), 1)
59 }
60
61 if !status.HasUpdate {
62 fmt.Printf("You are already on the latest version (%s)\n", status.CurrentVersion)
63 return
64 }
65
66 fmt.Printf("Updating from version %s to %s...\n", status.CurrentVersion, status.LatestVersion)
67
68 if err := performUpdate(status); err != nil {
69 fatal(fmt.Sprintf("Error during update: %v", err), 1)
70 }
71
72 fmt.Printf("Update complete! You are now on version %s\n", status.LatestVersion)
73}
74
75// checkForUpdate checks if a new version is available
76func checkForUpdate() (*UpdateStatus, error) {

Callers

nothing calls this directly

Calls 3

checkForUpdateFunction · 0.85
fatalFunction · 0.85
performUpdateFunction · 0.85

Tested by

no test coverage detected