From bc005d537d0149ef424cca5934e3da6020174bb8 Mon Sep 17 00:00:00 2001 From: Mickael Gaillard Date: Mon, 30 Jun 2025 16:08:28 +0200 Subject: [PATCH] Add support of name app --- internal/logic/scaling_resource.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/internal/logic/scaling_resource.go b/internal/logic/scaling_resource.go index c6fdbaf..0a0623b 100644 --- a/internal/logic/scaling_resource.go +++ b/internal/logic/scaling_resource.go @@ -84,24 +84,26 @@ func ScalingInstance(projectContext entity.ProjectGlobal) { // Parse output apps = strings.Split(output, "\n") for _, app_str := range apps[:len(apps)-1] { - app := strings.Split(app_str, ",") + app_raw := strings.Split(app_str, ",") // Normalize - name := app[0] - instance, err := strconv.Atoi(app[1]) + name := app_raw[0] + instance, err := strconv.Atoi(app_raw[1]) if err != nil { break } // Get or create app/service usage - usage, found := usages[name] - if !found { - usage = UsageApp{Name: name} - } + if app.ArgsS.Name == "" || app.ArgsS.Name == name { + usage, found := usages[name] + if !found { + usage = UsageApp{Name: name} + } - // Assign - usage.InstanceOld = instance - usages[name] = usage + // Assign + usage.InstanceOld = instance + usages[name] = usage + } } if !app.ArgsS.IncludeServices {