MCPcopy
hub / github.com/bootdotdev/bootdev / renderVariableSection

Function renderVariableSection

render/variables.go:19–33  ·  view source on GitHub ↗
(title string, entries []variableEntry)

Source from the content-addressed store, hash-verified

17}
18
19func 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
35func formatVariableValue(value string) string {
36 if value == "" {

Calls 1

formatVariableValueFunction · 0.85