package cmd import ( "fmt" ) // Status displays the current A/B slot configuration and boot state. func Status(args []string) error { opts := parseOpts(args) env := opts.NewBootEnv() activeSlot, err := env.ActiveSlot() if err != nil { return fmt.Errorf("reading active slot: %w", err) } passiveSlot, err := env.PassiveSlot() if err != nil { return fmt.Errorf("reading passive slot: %w", err) } bootCounter, err := env.BootCounter() if err != nil { return fmt.Errorf("reading boot counter: %w", err) } bootSuccess, err := env.BootSuccess() if err != nil { return fmt.Errorf("reading boot success: %w", err) } fmt.Println("KubeSolo OS — A/B Partition Status") fmt.Println("───────────────────────────────────") fmt.Printf(" Active slot: %s\n", activeSlot) fmt.Printf(" Passive slot: %s\n", passiveSlot) fmt.Printf(" Boot counter: %d\n", bootCounter) if bootSuccess { fmt.Printf(" Boot success: 1\n") } else { fmt.Printf(" Boot success: 0\n") } if bootSuccess { fmt.Println("\n ✓ System is healthy (boot confirmed)") } else if bootCounter == 0 { fmt.Println("\n ✗ Boot counter exhausted — rollback will occur on next reboot") } else { fmt.Printf("\n ⚠ Boot pending verification (%d attempts remaining)\n", bootCounter) } return nil }