chore: added internal comments 3528fe2b
Steve · 2026-11-08 23:31 3 file(s) · +26 −10
internal/style.go +15 −10
22 22
	Code string
23 23
}
24 24
25 +
// Palette can be edited or expanded
25 26
var Palette = []Color{
26 27
	{"Red", Red},
27 28
	{"Green", Green},
33 34
	{"Gray", Gray},
34 35
}
35 36
37 +
// Customize key color and swatch symbol
38 +
const KeyColor = Yellow
39 +
const PaletteSwatch = "●"
40 +
36 41
func Colorize(color, s string) string {
37 42
	return color + s + Reset
38 43
}
39 44
45 +
func PrintPalette() {
46 +
	fmt.Print("  ")
47 +
	for _, c := range Palette {
48 +
		swatch := Colorize(c.Code, PaletteSwatch + "  ")
49 +
		fmt.Print(swatch)
50 +
	}
51 +
	fmt.Println()
52 +
}
53 +
40 54
func PrintRows(rows []Row) {
41 55
	width := labelWidth(rows)
42 56
43 57
	fmt.Println()
44 58
	for _, row := range rows {
45 -
		label := Colorize(Bold+Yellow, fmt.Sprintf("%-*s", width, row.Key))
59 +
		label := Colorize(Bold+KeyColor, fmt.Sprintf("%-*s", width, row.Key))
46 60
		line := "  " + label + "    " + row.Value
47 61
48 62
		fmt.Println(line)
59 73
	}
60 74
	return width
61 75
}
62 -
63 -
func PrintPalette() {
64 -
	fmt.Print("  ")
65 -
	for _, c := range Palette {
66 -
		swatch := Colorize(c.Code, "●  ")
67 -
		fmt.Print(swatch)
68 -
	}
69 -
	fmt.Println()
70 -
}
internal/system.go +10 −0
16 16
	Value string
17 17
}
18 18
19 +
// Create a new function that returns a row 
20 +
//
21 +
// func MyInfo() Row {
22 +
// 		var myValue string
23 +
//
24 +
// 		// get the value here
25 +
//
26 +
// 		return Row{Key: "Foo", Value: myValue}
27 +
// }
28 +
19 29
func GetHostname() Row {
20 30
	hostname, err := os.Hostname()
21 31
	if err != nil {
main.go +1 −0
6 6
7 7
// Gobble: fetch in go for fun
8 8
9 +
// Add or update a row in ./internal/system.go
9 10
func main() {
10 11
	rows := []system.Row {
11 12
		system.GetHostname(),