Skip to content

Commit

Permalink
Fix for GitHub issue #175: Some UTF8/Iconic output might not display …
Browse files Browse the repository at this point in the history
…properly depending on font installed on system/terminal
  • Loading branch information
obourdon committed Oct 17, 2023
1 parent 695b8e1 commit 379df24
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion command/lb-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"flag"
"fmt"
"os"
"regexp"
"strings"

Expand Down Expand Up @@ -62,6 +63,12 @@ func (c *LBListCommand) Run(args []string) int {
var activeIcon string
var certBodyIcon string
var httpsIcon string
extraMsg := ""
termType := os.Getenv("TERM_PROGRAM")
matchTerm, _ := regexp.MatchString(".*[Tt][Mm][Uu][Xx].*", termType)
if matchTerm {
extraMsg = "\n\nPlease note that as you are using Tmux the UTF-8 icons might not be displayed properly unless you used the `-u` option"
}
for _, lb := range loadBalancers {
if lb.Active {
activeIcon = "✅"
Expand Down Expand Up @@ -89,7 +96,7 @@ func (c *LBListCommand) Run(args []string) int {

table.Render()
// Remove trailing \n and HT
return string(regexp.MustCompile(`[\n\x09][\n\x09]*$`).ReplaceAll([]byte(tableString.String()), []byte(""))), nil
return string(regexp.MustCompile(`[\n\x09][\n\x09]*$`).ReplaceAll([]byte(tableString.String()), []byte(""))) + extraMsg, nil
})
}

Expand Down

0 comments on commit 379df24

Please sign in to comment.