| 17 | } |
| 18 | |
| 19 | func renderVariableSection(title string, entries []variableEntry) string { |
| 20 | sort.Slice(entries, func(i, j int) bool { |
| 21 | if entries[i].name == entries[j].name { |
| 22 | return entries[i].description < entries[j].description |
| 23 | } |
| 24 | return entries[i].name < entries[j].name |
| 25 | }) |
| 26 | |
| 27 | var str strings.Builder |
| 28 | fmt.Fprintf(&str, " %s: \n", title) |
| 29 | for _, entry := range entries { |
| 30 | fmt.Fprintf(&str, " - %s: %s (%s)\n", entry.name, formatVariableValue(entry.value), entry.description) |
| 31 | } |
| 32 | return str.String() |
| 33 | } |
| 34 | |
| 35 | func formatVariableValue(value string) string { |
| 36 | if value == "" { |