Add --no-color option to force disabling colorized output (#4081)
Lint / golangci-lint (push) Waiting to run
Lint / semgrep (push) Waiting to run
Release / Release (push) Waiting to run
Scan for secrets / test (push) Waiting to run
Test / test (push) Waiting to run
Test / test-community (push) Waiting to run

* 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]>
This commit is contained in:
TheToddLuci0
2025-04-29 10:21:38 -05:00
committed by GitHub
co-authored by Kashif Khan
parent d1c547f984
commit b06f6d72a3
+7
View File
@@ -16,6 +16,7 @@ import (
"syscall"
"github.com/alecthomas/kingpin/v2"
"github.com/fatih/color"
"github.com/felixge/fgprof"
"github.com/go-logr/logr"
"github.com/jpillora/overseer"
@@ -58,6 +59,8 @@ var (
noVerification = cli.Flag("no-verification", "Don't verify the results.").Bool()
onlyVerified = cli.Flag("only-verified", "Only output verified results.").Hidden().Bool()
results = cli.Flag("results", "Specifies which type(s) of results to output: verified, unknown, unverified, filtered_unverified. Defaults to verified,unverified,unknown.").String()
noColor = cli.Flag("no-color", "Disable colorized output").Bool()
noColour = cli.Flag("no-colour", "Alias for --no-color").Hidden().Bool()
allowVerificationOverlap = cli.Flag("allow-verification-overlap", "Allow verification of similar credentials across detectors").Bool()
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() {
log.SetLevel(l)
}
}
if *noColor || *noColour {
color.NoColor = true // disables colorized output
}
}
func main() {