Merge pull request #338 from paivagustavo/escape-describe-text

escape text to not misinterpret it with colors.
mine
Fernand Galiana 2019-10-07 21:30:08 -07:00 committed by GitHub
commit ee1b734464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,8 @@ import (
"strings"
"time"
"github.com/derailed/tview"
"github.com/derailed/k9s/internal/config"
"github.com/rs/zerolog/log"
)
@ -24,7 +26,7 @@ const (
)
func colorizeYAML(style config.Yaml, raw string) string {
lines := strings.Split(raw, "\n")
lines := strings.Split(tview.Escape(raw), "\n")
fullFmt := strings.Replace(yamlFullFmt, "[key", "["+style.KeyColor, 1)
fullFmt = strings.Replace(fullFmt, "[colon", "["+style.ColonColor, 1)

View File

@ -43,6 +43,10 @@ func TestYaml(t *testing.T) {
"certmanager.k8s.io/cluster-issuer: nameOfClusterIssuer",
"[steelblue::b]certmanager.k8s.io/cluster-issuer[white::-]: [papayawhip::]nameOfClusterIssuer",
},
{
"Message: Pod The node was low on resource: [DiskPressure].",
"[steelblue::b]Message[white::-]: [papayawhip::]Pod The node was low on resource: [DiskPressure[].",
},
}
s, _ := config.NewStyles("skins/stock.yml")