From e9d1d20c6353c9f8ffcf98c1edea3aab92957f51 Mon Sep 17 00:00:00 2001 From: Hazel Noack Date: Thu, 9 Oct 2025 12:14:27 +0200 Subject: [PATCH] crossing out objects with no source --- internal/cli/shell.go | 9 +++- internal/common/color/color.go | 79 ++++++++++++++++++++++++++++------ 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/internal/cli/shell.go b/internal/cli/shell.go index 96be00c..52f7a6b 100644 --- a/internal/cli/shell.go +++ b/internal/cli/shell.go @@ -52,8 +52,13 @@ func printResults(musicObjects []data.MusicObject) { } } - for _, source := range m.GetSources() { - results[i] += "\n\t- " + source.Url + sources := m.GetSources() + if len(sources) > 0 { + for _, source := range sources { + results[i] += "\n\t- " + source.Url + } + } else { + results[i] = color.StrikeThrough + results[i] + color.Reset } } diff --git a/internal/common/color/color.go b/internal/common/color/color.go index fba0dca..2cf118d 100644 --- a/internal/common/color/color.go +++ b/internal/common/color/color.go @@ -1,23 +1,66 @@ package color import ( - "fmt" "runtime" ) -var Reset = "\033[0m" -var Red = "\033[31m" -var Green = "\033[32m" -var Yellow = "\033[33m" -var Blue = "\033[34m" -var Purple = "\033[35m" -var Cyan = "\033[36m" -var Gray = "\033[37m" -var White = "\033[97m" +var ( + Reset = "\033[0m" + + ///////////// + // Special // + ///////////// + + Bold = "\033[1m" + Underline = "\033[4m" + StrikeThrough = "\033[9m" + + ///////////////// + // Text colors // + ///////////////// + + Black = "\033[30m" + Red = "\033[31m" + Green = "\033[32m" + Yellow = "\033[33m" + Blue = "\033[34m" + Purple = "\033[35m" + Cyan = "\033[36m" + Gray = "\033[37m" + White = "\033[97m" + + /////////////////////// + // Background colors // + /////////////////////// + + BlackBackground = "\033[40m" + RedBackground = "\033[41m" + GreenBackground = "\033[42m" + YellowBackground = "\033[43m" + BlueBackground = "\033[44m" + PurpleBackground = "\033[45m" + CyanBackground = "\033[46m" + GrayBackground = "\033[47m" + WhiteBackground = "\033[107m" +) func init() { if runtime.GOOS == "windows" { Reset = "" + + ///////////// + // Special // + ///////////// + + Bold = "" + Underline = "" + StrikeThrough = "" + + ///////////////// + // Text colors // + ///////////////// + + Black = "" Red = "" Green = "" Yellow = "" @@ -26,7 +69,19 @@ func init() { Cyan = "" Gray = "" White = "" - } - fmt.Println("init") + /////////////////////// + // Background colors // + /////////////////////// + + BlackBackground = "" + RedBackground = "" + GreenBackground = "" + YellowBackground = "" + BlueBackground = "" + PurpleBackground = "" + CyanBackground = "" + GrayBackground = "" + WhiteBackground = "" + } }