@@ -39,6 +39,29 @@ const (
3939 minBoxWidth = 50
4040)
4141
42+ // Display constants.
43+ const (
44+ // Configuration headers.
45+ removedConfigHeader = "REMOVED CONFIGURATIONS"
46+ newConfigHeader = "NEW CONFIGURATIONS"
47+ modifiedConfigHeader = "MODIFIED CONFIGURATIONS"
48+
49+ // Icons and prefixes.
50+ iconRemoval = "❌"
51+ iconAddition = "✅"
52+ iconModification = "🔄"
53+ removalPrefix = "-"
54+ additionPrefix = "+"
55+ modificationPrefix = "~"
56+
57+ // Business logic constants.
58+ defaultSectionName = "general"
59+ enterpriseOnlyText = "Enterprise Edition Only"
60+ allowedValuesText = "Allowed values"
61+ booleanYesText = "Yes"
62+ booleanNoText = "No"
63+ )
64+
4265// SchemaChange represents a single schema change.
4366type SchemaChange struct {
4467 Path string
@@ -237,7 +260,7 @@ func extractSection(path string, validSections map[string]bool) string {
237260 }
238261
239262 // If we didn't find a valid section, return "general"
240- return "general"
263+ return defaultSectionName
241264}
242265
243266// Output formatting
@@ -307,9 +330,9 @@ func printAllChanges(changes SectionChanges, options DiffOptions) {
307330 icon string
308331 prefix string
309332 }{
310- {changes .Removals , "REMOVED CONFIGURATIONS" , "❌" , "-" },
311- {changes .Additions , "NEW CONFIGURATIONS" , "✅" , "+" },
312- {changes .Modifications , "MODIFIED CONFIGURATIONS" , "🔄" , "~" },
333+ {changes .Removals , removedConfigHeader , iconRemoval , removalPrefix },
334+ {changes .Additions , newConfigHeader , iconAddition , additionPrefix },
335+ {changes .Modifications , modifiedConfigHeader , iconModification , modificationPrefix },
313336 }
314337
315338 // Process each change type
@@ -326,7 +349,7 @@ func printAllChanges(changes SectionChanges, options DiffOptions) {
326349 }
327350
328351 // Handle modifications with array processing
329- if config .header == "MODIFIED CONFIGURATIONS" {
352+ if config .header == modifiedConfigHeader {
330353 printModifications (config .changes , options , config .icon , config .prefix )
331354 continue
332355 }
@@ -373,7 +396,7 @@ func printArrayChangeVerbose(change SchemaChange, path, header, icon string, opt
373396 }
374397
375398 // Print additional details for additions (only for simple objects)
376- if header == "NEW CONFIGURATIONS" && ! isComplexProperty (change .Value ) {
399+ if header == newConfigHeader && ! isComplexProperty (change .Value ) {
377400 printValueProperties (change .Value , options )
378401 }
379402}
@@ -392,7 +415,7 @@ func printNormalChange(change SchemaChange, path, header, icon, prefix string, o
392415 if options .Verbose {
393416 fmt .Fprintf (os .Stdout , " %s %s\n " , icon , path )
394417 // Print additional details for additions
395- if header == "NEW CONFIGURATIONS" {
418+ if header == newConfigHeader {
396419 printValueProperties (change .Value , options )
397420 }
398421 } else {
@@ -647,9 +670,9 @@ func formatKeyName(key string) string {
647670 // Handle common special cases
648671 switch key {
649672 case "enterpriseOnly" :
650- return "Enterprise Edition Only"
673+ return enterpriseOnlyText
651674 case "enum" :
652- return "Allowed values"
675+ return allowedValuesText
653676 default :
654677 // Simple camelCase to Title Case conversion
655678 if len (key ) == 0 {
@@ -668,9 +691,9 @@ func formatValue(value any) string {
668691 switch v := value .(type ) {
669692 case bool :
670693 if v {
671- return "Yes"
694+ return booleanYesText
672695 }
673- return "No"
696+ return booleanNoText
674697 case string :
675698 if v == "" {
676699 return ""
0 commit comments