Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-10-05 00:56:01 +01:00
parent a28e1cb7a0
commit 4d11b5354c
5 changed files with 33 additions and 25 deletions

View file

@ -13,12 +13,20 @@ import (
)
type ZetList struct {
Ids []int
Ids []int
UseColors bool
}
func CreateZetList(ids []int) *ZetList {
func CreateZetList(ids []int, useColors ...bool) *ZetList {
colorSetting := true
if len(useColors) > 0 {
colorSetting = useColors[0]
}
return &ZetList{
Ids: ids,
Ids: ids,
UseColors: colorSetting,
}
}
@ -29,7 +37,11 @@ func (z *ZetList) Parse() []string {
reset := "\033[0m"
for _, num := range z.Ids {
line := fmt.Sprintf("%s%s%s %s", green, strconv.Itoa(num), reset, getTitle(num))
line := fmt.Sprintf("%s %s", strconv.Itoa(num), getTitle(num))
if z.UseColors {
line = fmt.Sprintf("%s%s%s %s", green, strconv.Itoa(num), reset, getTitle(num))
}
lines = append(lines, line)
}