|
6 | 6 | "strings" |
7 | 7 | "time" |
8 | 8 |
|
| 9 | + "github.com/charmbracelet/lipgloss" |
9 | 10 | "github.com/jessequinn/drift-analysis-cli/pkg/report" |
10 | 11 | "gopkg.in/yaml.v3" |
11 | 12 | ) |
@@ -86,23 +87,44 @@ func (r *DriftReport) countBySeverity() (critical, high, medium, low int) { |
86 | 87 | func (cd *ClusterDrift) FormatText() string { |
87 | 88 | var sb strings.Builder |
88 | 89 |
|
89 | | - sb.WriteString("───────────────────────────────────────────────────────────────────────────────\n") |
90 | | - sb.WriteString(fmt.Sprintf("Cluster: %s\n", cd.Name)) |
91 | | - sb.WriteString(fmt.Sprintf("Project: %s\n", cd.Project)) |
92 | | - sb.WriteString(fmt.Sprintf("Location: %s\n", cd.Location)) |
93 | | - sb.WriteString(fmt.Sprintf("Status: %s\n", cd.Status)) |
| 90 | + // Define styles |
| 91 | + headerStyle := lipgloss.NewStyle(). |
| 92 | + Bold(true). |
| 93 | + Foreground(lipgloss.Color("45")). |
| 94 | + Background(lipgloss.Color("236")). |
| 95 | + Padding(0, 1) |
| 96 | + |
| 97 | + labelStyle := lipgloss.NewStyle(). |
| 98 | + Foreground(lipgloss.Color("244")). |
| 99 | + Bold(true) |
| 100 | + |
| 101 | + valueStyle := lipgloss.NewStyle(). |
| 102 | + Foreground(lipgloss.Color("252")) |
| 103 | + |
| 104 | + nodePoolStyle := lipgloss.NewStyle(). |
| 105 | + Foreground(lipgloss.Color("cyan")) |
| 106 | + |
| 107 | + divider := lipgloss.NewStyle(). |
| 108 | + Foreground(lipgloss.Color("240")). |
| 109 | + Render("───────────────────────────────────────────────────────────────────────────────") |
| 110 | + |
| 111 | + sb.WriteString(divider + "\n") |
| 112 | + sb.WriteString(headerStyle.Render(fmt.Sprintf("☸ GKE Cluster: %s", cd.Name)) + "\n\n") |
| 113 | + sb.WriteString(labelStyle.Render("Project: ") + valueStyle.Render(cd.Project) + "\n") |
| 114 | + sb.WriteString(labelStyle.Render("Location: ") + valueStyle.Render(cd.Location) + "\n") |
| 115 | + sb.WriteString(labelStyle.Render("Status: ") + valueStyle.Render(cd.Status) + "\n") |
94 | 116 |
|
95 | 117 | if len(cd.Labels) > 0 { |
96 | 118 | if role, exists := cd.Labels["cluster-role"]; exists { |
97 | | - sb.WriteString(fmt.Sprintf("Role: %s\n", role)) |
| 119 | + sb.WriteString(labelStyle.Render("Role: ") + valueStyle.Render(role) + "\n") |
98 | 120 | } |
99 | 121 | } |
100 | 122 |
|
101 | 123 | // Show node pools summary |
102 | 124 | if len(cd.NodePools) > 0 { |
103 | | - sb.WriteString(fmt.Sprintf("Node Pools: %d\n", len(cd.NodePools))) |
| 125 | + sb.WriteString(labelStyle.Render(fmt.Sprintf("Node Pools: %d", len(cd.NodePools))) + "\n") |
104 | 126 | for _, np := range cd.NodePools { |
105 | | - sb.WriteString(fmt.Sprintf(" - %s: %s (%d nodes)\n", np.Name, np.MachineType, np.InitialNodeCount)) |
| 127 | + sb.WriteString(nodePoolStyle.Render(fmt.Sprintf(" • %s: %s (%d nodes)", np.Name, np.MachineType, np.InitialNodeCount)) + "\n") |
106 | 128 | } |
107 | 129 | } |
108 | 130 |
|
|
0 commit comments