Skip to content

Commit

Permalink
Removed emoji for Windows OS (#48)
Browse files Browse the repository at this point in the history
* Removed emoji for Windows OS

* Added comment
  • Loading branch information
Etourneau Gwenn authored Feb 6, 2023
1 parent 1812916 commit 042efc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/formatter/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package formatter
import (
"encoding/json"
"fmt"
"runtime"

"github.com/enescakir/emoji"
"github.com/inhies/go-bytesize"
Expand Down Expand Up @@ -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()
Expand All @@ -123,7 +130,7 @@ func clusterHealthStateToEmoji(healthState ybmclient.ClusterHealthState) string
case ybmclient.CLUSTERHEALTHSTATE_UNKNOWN:
return emoji.QuestionMark.String()
default:
return ""
return string(healthState)
}
}

Expand Down

0 comments on commit 042efc5

Please sign in to comment.