Skip to content

Commit b06f6d7

Browse files
Add --no-color option to force disabling colorized output (#4081)
* Add --no-color option to force disabling colorized output * Add british (incorrect) spelling for --no-color as a hidden alias value --------- Co-authored-by: Kashif Khan <[email protected]>
1 parent d1c547f commit b06f6d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"syscall"
1717

1818
"github.com/alecthomas/kingpin/v2"
19+
"github.com/fatih/color"
1920
"github.com/felixge/fgprof"
2021
"github.com/go-logr/logr"
2122
"github.com/jpillora/overseer"
@@ -58,6 +59,8 @@ var (
5859
noVerification = cli.Flag("no-verification", "Don't verify the results.").Bool()
5960
onlyVerified = cli.Flag("only-verified", "Only output verified results.").Hidden().Bool()
6061
results = cli.Flag("results", "Specifies which type(s) of results to output: verified, unknown, unverified, filtered_unverified. Defaults to verified,unverified,unknown.").String()
62+
noColor = cli.Flag("no-color", "Disable colorized output").Bool()
63+
noColour = cli.Flag("no-colour", "Alias for --no-color").Hidden().Bool()
6164

6265
allowVerificationOverlap = cli.Flag("allow-verification-overlap", "Allow verification of similar credentials across detectors").Bool()
6366
filterUnverified = cli.Flag("filter-unverified", "Only output first unverified result per chunk per detector if there are more than one results.").Bool()
@@ -318,6 +321,10 @@ func init() {
318321
log.SetLevel(l)
319322
}
320323
}
324+
325+
if *noColor || *noColour {
326+
color.NoColor = true // disables colorized output
327+
}
321328
}
322329

323330
func main() {

0 commit comments

Comments
 (0)