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 (
"errors"
"github.com/gookit/color"
"io"
"os"
)
@@ -26,6 +27,10 @@ import (
func ProcessFiles(args []string) error {
fds, pattern, err := determineIO(args)
if !isTerminal(os.Stdout) {
color.Disable()
}
if err != nil {
return err
}
@@ -52,6 +57,7 @@ func determineIO(args []string) ([]io.Reader, string, error) {
// first one is not a file, consider it as regexp and
// shift arg list
pattern = args[0]
Pattern = args[0] // FIXME
args = args[1:]
}