added pattern highlighting support

This commit is contained in:
2022-10-10 20:14:51 +02:00
parent 34e2b8d855
commit f890596b4c
11 changed files with 74 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ package lib
import (
"fmt"
"github.com/gookit/color"
"os"
"strings"
"testing"
@@ -64,6 +65,8 @@ asd igig cxxxncnc
ONE="19191" TWO="EDD 1" THREE="X"`,
}
NoColor = true
r, w, err := os.Pipe()
if err != nil {
t.Fatal(err)
@@ -71,6 +74,9 @@ ONE="19191" TWO="EDD 1" THREE="X"`,
origStdout := os.Stdout
os.Stdout = w
// we need to tell the color mode the io.Writer, even if we don't usw colorization
color.SetOutput(w)
for mode, expect := range expects {
testname := fmt.Sprintf("print-%s", mode)
t.Run(testname, func(t *testing.T) {