From 629c629b2e285a9722a288d03ec9ecbd1af2d58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Fri, 9 Jan 2026 14:31:11 +0100 Subject: [PATCH 1/2] Don't format integer config values in scientific notation instead of ``` rabbit.max_message_size 1.34217728e+08 ``` ``` rabbit.max_message_size 134217728 ``` --- cmd/instance_config.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cmd/instance_config.go b/cmd/instance_config.go index 6cb4836..0b0b5ba 100644 --- a/cmd/instance_config.go +++ b/cmd/instance_config.go @@ -9,6 +9,20 @@ import ( "github.com/spf13/cobra" ) +// formatValue formats a configuration value, avoiding scientific notation for numbers +func formatValue(value interface{}) string { + switch v := value.(type) { + case float64: + // If it's a whole number, display as integer + if v == float64(int64(v)) { + return fmt.Sprintf("%.0f", v) + } + return fmt.Sprintf("%v", v) + default: + return fmt.Sprintf("%v", v) + } +} + var instanceConfigCmd = &cobra.Command{ Use: "config", Short: "Manage RabbitMQ configuration", @@ -56,7 +70,7 @@ var instanceConfigListCmd = &cobra.Command{ // Print configuration data for key, value := range config { - valueStr := fmt.Sprintf("%v", value) + valueStr := formatValue(value) if len(valueStr) > 30 { valueStr = valueStr[:27] + "..." } @@ -96,7 +110,8 @@ var instanceConfigGetCmd = &cobra.Command{ } if value, exists := config[settingName]; exists { - fmt.Printf("%s: %v\n", settingName, value) + valueStr := formatValue(value) + fmt.Printf("%s: %s\n", settingName, valueStr) } else { fmt.Printf("Setting '%s' not found\n", settingName) } From 830352007d54df5850f6e1fc14a3ac792e47fee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Fri, 9 Jan 2026 14:47:25 +0100 Subject: [PATCH 2/2] List config sorted like on the console UI --- cmd/instance_config.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/instance_config.go b/cmd/instance_config.go index 0b0b5ba..f911a5b 100644 --- a/cmd/instance_config.go +++ b/cmd/instance_config.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "sort" "strconv" "strings" @@ -69,8 +70,16 @@ var instanceConfigListCmd = &cobra.Command{ fmt.Printf("%-40s %-30s\n", "---", "-----") // Print configuration data - for key, value := range config { - valueStr := formatValue(value) + // Extract and sort keys alphabetically + keys := make([]string, 0, len(config)) + for key := range config { + keys = append(keys, key) + } + sort.Strings(keys) + + // Print sorted configuration + for _, key := range keys { + valueStr := formatValue(config[key]) if len(valueStr) > 30 { valueStr = valueStr[:27] + "..." }