From 1f1fef56dbbf6b7cdc9c9e70df39e044c5c34ffc Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Sat, 25 Apr 2026 05:54:39 +0300 Subject: [PATCH] feat: Add start-all and stop-all commands to services with simulation output and table display - Add "start-all" and "stop-all" cases to services command handler - Add startAllServices function with table output for service name, status, and message - Add stopAllServices function with reverse service order for graceful shutdown - Add service list iteration with status display for api-server, charging-engine, carrier-connector, packet-gateway, and web-dashboard - Add "start-all" and "stop-all" commands --- apps/cli/internal/commands/services.go | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/apps/cli/internal/commands/services.go b/apps/cli/internal/commands/services.go index 3ce323a..9dfbe4b 100644 --- a/apps/cli/internal/commands/services.go +++ b/apps/cli/internal/commands/services.go @@ -27,6 +27,10 @@ func HandleServices(args []string, config *types.CLIConfig) error { return restartService(u, args[1:]) case "logs": return showServiceLogs(u, args[1:]) + case "start-all": + return startAllServices(u) + case "stop-all": + return stopAllServices(u) default: u.errorln("Unknown services command: " + command) showServicesHelp(u) @@ -46,6 +50,8 @@ func showServicesHelp(u *uiContext) { t.AddRow("status ", "Show service status") t.AddRow("restart ", "Restart a service") t.AddRow("logs ", "Show service logs") + t.AddRow("start-all", "Start all platform services") + t.AddRow("stop-all", "Stop all platform services") fmt.Println(t.Render()) } @@ -162,3 +168,47 @@ func showServiceLogs(u *uiContext, args []string) error { } return nil } + +func startAllServices(u *uiContext) error { + u.header("Starting All Platform Services") + u.muted("(Service orchestration API not yet connected - showing simulation)") + + services := []string{"api-server", "charging-engine", "carrier-connector", "packet-gateway", "web-dashboard"} + + t := u.newTable() + t.AddColumn("Service", 18, "left") + t.AddColumn("Status", 12, "left") + t.AddColumn("Message", 40, "left") + + for _, svc := range services { + u.info("Starting " + svc + "...") + t.AddStyledRow(statusStyle("OK").Style, svc, "Starting", "Initiating service startup") + } + + fmt.Println(t.Render()) + u.success("All services start sequence initiated!") + u.muted("Note: This is a simulation. Implement actual service orchestration via Kubernetes API or process manager.") + return nil +} + +func stopAllServices(u *uiContext) error { + u.header("Stopping All Platform Services") + u.muted("(Service orchestration API not yet connected - showing simulation)") + + services := []string{"web-dashboard", "packet-gateway", "carrier-connector", "charging-engine", "api-server"} + + t := u.newTable() + t.AddColumn("Service", 18, "left") + t.AddColumn("Status", 12, "left") + t.AddColumn("Message", 40, "left") + + for _, svc := range services { + u.info("Stopping " + svc + "...") + t.AddStyledRow(statusStyle("OK").Style, svc, "Stopping", "Initiating graceful shutdown") + } + + fmt.Println(t.Render()) + u.success("All services stop sequence initiated!") + u.muted("Note: This is a simulation. Implement actual service orchestration via Kubernetes API or process manager.") + return nil +}