From 042efc5a316475d82b449f3e3861878bacaa630c Mon Sep 17 00:00:00 2001 From: Etourneau Gwenn Date: Mon, 6 Feb 2023 15:14:36 +0900 Subject: [PATCH] Removed emoji for Windows OS (#48) * Removed emoji for Windows OS * Added comment --- internal/formatter/clusters.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/formatter/clusters.go b/internal/formatter/clusters.go index 0f04298d..6fe81638 100644 --- a/internal/formatter/clusters.go +++ b/internal/formatter/clusters.go @@ -3,6 +3,7 @@ package formatter import ( "encoding/json" "fmt" + "runtime" "github.com/enescakir/emoji" "github.com/inhies/go-bytesize" @@ -113,6 +114,12 @@ func (c *ClusterContext) totalResource(resource int32) int32 { // clusterHealthStateToEmoji return emoji based on cluster health state // See http://www.unicode.org/emoji/charts/emoji-list.html#1f49a func clusterHealthStateToEmoji(healthState ybmclient.ClusterHealthState) string { + + // Windows terminal do not support emoji + // So we return directly the healthstate + if runtime.GOOS == "windows" { + return string(healthState) + } switch healthState { case ybmclient.CLUSTERHEALTHSTATE_HEALTHY: return emoji.GreenHeart.String() @@ -123,7 +130,7 @@ func clusterHealthStateToEmoji(healthState ybmclient.ClusterHealthState) string case ybmclient.CLUSTERHEALTHSTATE_UNKNOWN: return emoji.QuestionMark.String() default: - return "" + return string(healthState) } }