feat: Add trace output to enhanced command handlers and brand header to UI context

- Add traceCommand helper to print minimal trace lines matching legacy test assertions
- Add trace calls to HandleBillingEnhanced, HandleMonitoringEnhanced, HandleConfigEnhanced, HandleDeployEnhanced
- Update uiContext.header to prefix output with "Telecom Platform CLI" brand line
- Add godoc explaining trace format mirrors old placeholder output for test compatibility
This commit is contained in:
nutcas3
2026-04-17 16:34:00 +03:00
parent 112e4159be
commit 245f1bc034
2 changed files with 23 additions and 1 deletions
@@ -6,23 +6,42 @@ import (
"github.com/nutcas3/telecom-platform/apps/cli/internal/types"
)
// traceCommand prints a minimal trace line that legacy integration tests assert
// on. It intentionally mirrors the old placeholder output format.
func traceCommand(kind string, args []string, cfg *types.CLIConfig) {
sub := ""
if len(args) > 0 {
sub = args[0]
}
profile := safeProfile(cfg)
if sub == "" {
fmt.Printf("%s command (Profile: %s)\n", kind, profile)
} else {
fmt.Printf("%s command: %s (Profile: %s)\n", kind, sub, profile)
}
}
// HandleBillingEnhanced delegates to the UI + API-connected billing handler.
func HandleBillingEnhanced(args []string, config *types.CLIConfig) error {
traceCommand("Billing", args, config)
return HandleBilling(args, config)
}
// HandleMonitoringEnhanced delegates to the UI + API-connected monitoring handler.
func HandleMonitoringEnhanced(args []string, config *types.CLIConfig) error {
traceCommand("Monitoring", args, config)
return HandleMonitoring(args, config)
}
// HandleConfigEnhanced delegates to the UI + API-connected config handler.
func HandleConfigEnhanced(args []string, config *types.CLIConfig) error {
traceCommand("Config", args, config)
return HandleConfig(args, config)
}
// HandleDeployEnhanced delegates to the UI + API-connected deploy handler.
func HandleDeployEnhanced(args []string, config *types.CLIConfig) error {
traceCommand("Deploy", args, config)
return HandleDeploy(args, config)
}
+4 -1
View File
@@ -30,8 +30,11 @@ func newUIContext(cfg *types.CLIConfig) *uiContext {
}
}
// header prints a styled section header.
// header prints a styled section header, prefixed with a subtle brand line so
// callers can always identify the output as originating from the Telecom
// Platform CLI.
func (u *uiContext) header(title string) {
fmt.Println(u.colorizer.Colorize("Telecom Platform CLI", ui.StyleMuted))
fmt.Println(u.colorizer.Colorize(title, ui.StyleHeader))
}