(cmd *cobra.Command, args []string)
| 53 | } |
| 54 | |
| 55 | func 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 |
| 76 | func checkForUpdate() (*UpdateStatus, error) { |
nothing calls this directly
no test coverage detected