1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 13:19:02 +08:00

fix color print in cmd.exe (#78)

This commit is contained in:
zpcc 2022-02-08 18:01:55 +08:00 committed by GitHub
parent 9100a6d2ff
commit 75d8173f77

View File

@ -6,6 +6,7 @@ import (
"os"
"strings"
"github.com/fatih/color"
"github.com/zu1k/nali/internal/entity"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
@ -22,9 +23,9 @@ func Root(args []string, needTransform bool) {
if line == "quit" || line == "exit" {
return
}
fmt.Printf("%s\n", entity.ParseLine(line).ColorString())
fmt.Fprintf(color.Output, "%s\n", entity.ParseLine(line).ColorString())
}
} else {
fmt.Printf("%s\n", entity.ParseLine(strings.Join(args, " ")).ColorString())
fmt.Fprintf(color.Output, "%s\n", entity.ParseLine(strings.Join(args, " ")).ColorString())
}
}