From 6e3419e1424e64adaa7a65f301f9793a7b6b6d15 Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Tue, 26 Nov 2024 14:59:27 -0500 Subject: [PATCH] Add Windows-friendly alternative for our checkup status emojis --- ee/debug/checkups/checkups.go | 17 ----------------- ee/debug/checkups/checkups_other.go | 21 +++++++++++++++++++++ ee/debug/checkups/checkups_windows.go | 23 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 ee/debug/checkups/checkups_other.go create mode 100644 ee/debug/checkups/checkups_windows.go diff --git a/ee/debug/checkups/checkups.go b/ee/debug/checkups/checkups.go index beff7a444..3232cdc9f 100644 --- a/ee/debug/checkups/checkups.go +++ b/ee/debug/checkups/checkups.go @@ -46,23 +46,6 @@ const ( Failing Status = "Failing" // Checkup is failing ) -func (s Status) Emoji() string { - switch s { - case Informational: - return " " - case Passing: - return "✅" - case Warning: - return "⚠️" - case Failing: - return "❌" - case Erroring: - return "❌" - default: - return "? " - } -} - func writeSummary(w io.Writer, s Status, name, msg string) { fmt.Fprintf(w, "%s\t%s: %s\n", s.Emoji(), name, msg) } diff --git a/ee/debug/checkups/checkups_other.go b/ee/debug/checkups/checkups_other.go new file mode 100644 index 000000000..bb006e83b --- /dev/null +++ b/ee/debug/checkups/checkups_other.go @@ -0,0 +1,21 @@ +//go:build !windows +// +build !windows + +package checkups + +func (s Status) Emoji() string { + switch s { + case Informational: + return " " + case Passing: + return "✅" + case Warning: + return "⚠️" + case Failing: + return "❌" + case Erroring: + return "❌" + default: + return "? " + } +} diff --git a/ee/debug/checkups/checkups_windows.go b/ee/debug/checkups/checkups_windows.go new file mode 100644 index 000000000..a5da2b397 --- /dev/null +++ b/ee/debug/checkups/checkups_windows.go @@ -0,0 +1,23 @@ +//go:build windows +// +build windows + +package checkups + +// Emoji returns the Windows-friendly symbol for the given status. Powershell will not +// display actual emojis. +func (s Status) Emoji() string { + switch s { + case Informational: + return " " + case Passing: + return "OK " + case Warning: + return "! " + case Failing: + return "X " + case Erroring: + return "X " + default: + return "? " + } +}