diff --git a/internal/chart/providers/helm/manager.go b/internal/chart/providers/helm/manager.go index e3df8298..a6b05df4 100644 --- a/internal/chart/providers/helm/manager.go +++ b/internal/chart/providers/helm/manager.go @@ -313,7 +313,7 @@ func (h *HelmManager) InstallArgoCDWithProgress(ctx context.Context, config conf var spinner *uispinner.Spinner if !config.Silent && !config.NonInteractive { spinner = uispinner.Start("Installing ArgoCD...") - } else { + } else if !config.Silent { pterm.Info.Println("Installing ArgoCD...") } diff --git a/internal/chart/services/appofapps.go b/internal/chart/services/appofapps.go index c86763f7..8d39eb3c 100644 --- a/internal/chart/services/appofapps.go +++ b/internal/chart/services/appofapps.go @@ -51,7 +51,9 @@ func (a *AppOfApps) Install(ctx context.Context, config config.ChartInstallConfi // wording read as if it reflected the cluster's current ref, which made a // dry-run against a cluster on another ref confusing (verification report, // minor observation). - pterm.Info.Printf("Deploying ref '%s'...\n", appConfig.GitHubBranch) + if !config.Silent { + pterm.Info.Printf("Deploying ref '%s'...\n", appConfig.GitHubBranch) + } // Clone the repository to a temporary directory. On a cold cache this is a // full clone over the network and used to run without any indicator. @@ -120,3 +122,4 @@ func (a *AppOfApps) IsInstalled(ctx context.Context, namespace string) (bool, er func (a *AppOfApps) GetStatus(ctx context.Context, namespace string) (models.ChartInfo, error) { return a.helmManager.GetChartStatus(ctx, "app-of-apps", namespace) } + diff --git a/internal/cluster/providers/k3d/verify.go b/internal/cluster/providers/k3d/verify.go index 980c8c9f..1abee9da 100644 --- a/internal/cluster/providers/k3d/verify.go +++ b/internal/cluster/providers/k3d/verify.go @@ -9,6 +9,8 @@ import ( "strings" "time" + "github.com/pterm/pterm" + sharedconfig "github.com/flamingo-stack/openframe-cli/internal/shared/config" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -46,7 +48,7 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str } if m.verbose { - fmt.Printf("✓ Switched kubectl context to %s\n", contextName) + pterm.Success.Printfln("Switched kubectl context to %s", contextName) } // Build rest.Config from the loaded Kubeconfig @@ -66,7 +68,7 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str restConfig = sharedconfig.ApplyInsecureTLSConfig(restConfig) if m.verbose { - fmt.Println("✓ TLS verification bypassed for local k3d cluster (Insecure=true, auth preserved)") + pterm.Success.Println("TLS verification bypassed for local k3d cluster (Insecure=true, auth preserved)") } // --- PHASE 2: Verify Network Connectivity and Update Endpoint --- @@ -75,7 +77,7 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str host, port, err := extractHostPort(restConfig.Host) if err != nil { if m.verbose { - fmt.Printf("Warning: Could not extract host:port from %s: %v\n", restConfig.Host, err) + pterm.Warning.Printfln("Could not extract host:port from %s: %v", restConfig.Host, err) } // Default to 127.0.0.1:6550 for k3d host = "127.0.0.1" @@ -105,7 +107,7 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str var lastErr error if m.verbose { - fmt.Println("Waiting for cluster API and nodes to be reachable...") + pterm.Info.Println("Waiting for cluster API and nodes to be reachable...") } for i := 0; i < maxRetries; i++ { @@ -123,7 +125,7 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str if isTemporaryError(err) { lastErr = err if m.verbose { - fmt.Printf(" Cluster not ready yet (attempt %d/%d): %v\n", i+1, maxRetries, err) + pterm.Info.Printfln(" Cluster not ready yet (attempt %d/%d): %v", i+1, maxRetries, err) } time.Sleep(retryDelay) continue @@ -136,7 +138,7 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str if len(nodes.Items) == 0 { lastErr = fmt.Errorf("no nodes found in cluster") if m.verbose { - fmt.Printf(" No nodes found yet (attempt %d/%d), waiting...\n", i+1, maxRetries) + pterm.Info.Printfln(" No nodes found yet (attempt %d/%d), waiting...", i+1, maxRetries) } time.Sleep(retryDelay) continue @@ -157,15 +159,15 @@ func (m *K3dManager) verifyClusterReachable(ctx context.Context, clusterName str // Success condition: Nodes exist and at least one is ready if readyCount > 0 { if m.verbose { - fmt.Printf(" Found %d ready node(s) out of %d total\n", readyCount, len(nodes.Items)) - fmt.Println("✓ Cluster API and nodes are ready.") + pterm.Info.Printfln(" Found %d ready node(s) out of %d total", readyCount, len(nodes.Items)) + pterm.Success.Println("Cluster API and nodes are ready.") } return restConfig, nil } lastErr = fmt.Errorf("no nodes in Ready state (found %d nodes, 0 ready)", len(nodes.Items)) if m.verbose { - fmt.Printf(" Nodes exist but none are Ready yet (attempt %d/%d), waiting...\n", i+1, maxRetries) + pterm.Info.Printfln(" Nodes exist but none are Ready yet (attempt %d/%d), waiting...", i+1, maxRetries) } time.Sleep(retryDelay) } @@ -194,7 +196,7 @@ func (m *K3dManager) waitForTCPPort(ctx context.Context, host string, port strin address := net.JoinHostPort(host, port) if m.verbose { - fmt.Printf("Waiting for TCP port %s to be available...\n", address) + pterm.Info.Printfln("Waiting for TCP port %s to be available...", address) } var lastErr error @@ -212,14 +214,14 @@ func (m *K3dManager) waitForTCPPort(ctx context.Context, host string, port strin if err == nil { _ = conn.Close() if m.verbose { - fmt.Printf("✓ TCP port %s is open\n", address) + pterm.Success.Printfln("TCP port %s is open", address) } return nil } lastErr = err if m.verbose { - fmt.Printf(" TCP port not ready yet (attempt %d/%d): %v\n", i+1, maxRetries, err) + pterm.Info.Printfln(" TCP port not ready yet (attempt %d/%d): %v", i+1, maxRetries, err) } time.Sleep(retryDelay) } @@ -301,8 +303,9 @@ func (m *K3dManager) cleanupStaleLockFiles(ctx context.Context) error { } if m.verbose { - fmt.Println("✓ Cleaned up stale kubeconfig lock files") + pterm.Success.Println("Cleaned up stale kubeconfig lock files") } return nil } + diff --git a/internal/cluster/ui/wizard_steps.go b/internal/cluster/ui/wizard_steps.go index 529faf6c..669a6736 100644 --- a/internal/cluster/ui/wizard_steps.go +++ b/internal/cluster/ui/wizard_steps.go @@ -274,7 +274,7 @@ func (ws *WizardSteps) ConfirmConfiguration(config models.ClusterConfig) (bool, if i == 0 { continue // Skip header } - println(row[0] + ": " + row[1]) + pterm.Info.Printf("%s: %s\n", row[0], row[1]) } }