Merge pull request #338 from paivagustavo/escape-describe-text
escape text to not misinterpret it with colors.mine
commit
ee1b734464
|
|
@ -8,6 +8,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/derailed/tview"
|
||||||
|
|
||||||
"github.com/derailed/k9s/internal/config"
|
"github.com/derailed/k9s/internal/config"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
@ -24,7 +26,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func colorizeYAML(style config.Yaml, raw string) string {
|
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(yamlFullFmt, "[key", "["+style.KeyColor, 1)
|
||||||
fullFmt = strings.Replace(fullFmt, "[colon", "["+style.ColonColor, 1)
|
fullFmt = strings.Replace(fullFmt, "[colon", "["+style.ColonColor, 1)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,10 @@ func TestYaml(t *testing.T) {
|
||||||
"certmanager.k8s.io/cluster-issuer: nameOfClusterIssuer",
|
"certmanager.k8s.io/cluster-issuer: nameOfClusterIssuer",
|
||||||
"[steelblue::b]certmanager.k8s.io/cluster-issuer[white::-]: [papayawhip::]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")
|
s, _ := config.NewStyles("skins/stock.yml")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue