| 46 | } |
| 47 | |
| 48 | func checkVersionStatus(cmd *cobra.Command) { |
| 49 | info := version.FromContext(cmd.Context()) |
| 50 | if info == nil || info.FailedToFetch != nil { |
| 51 | fmt.Println("Unable to check version status") |
| 52 | if info != nil && info.FailedToFetch != nil { |
| 53 | fmt.Printf("Error: %s\n", info.FailedToFetch.Error()) |
| 54 | } |
| 55 | return |
| 56 | } |
| 57 | |
| 58 | if info.IsOutdated { |
| 59 | fmt.Printf("CLI outdated: %s → %s available\n", info.CurrentVersion, info.LatestVersion) |
| 60 | fmt.Println("Run 'bootdev upgrade' to update") |
| 61 | } else { |
| 62 | fmt.Printf("CLI up to date (%s)\n", info.CurrentVersion) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func init() { |
| 67 | rootCmd.AddCommand(statusCmd) |