mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Turn the color always on when the text format is set
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
c4417de46d
commit
1a113d6da9
1 changed files with 4 additions and 6 deletions
|
@ -120,9 +120,6 @@ var (
|
|||
// exlude the folders from scan
|
||||
flagDirsExclude arrayFlags
|
||||
|
||||
// set color on text format output
|
||||
flagColor = flag.Bool("color", false, "Enable colored output. Valid for text format")
|
||||
|
||||
logger *log.Logger
|
||||
)
|
||||
|
||||
|
@ -286,8 +283,9 @@ func main() {
|
|||
}
|
||||
|
||||
// Color flag is allowed for text format
|
||||
if *flagColor && *flagFormat != "text" {
|
||||
logger.Fatalf("cannot set color with %s format. Only text format is accepted", *flagFormat)
|
||||
var color bool
|
||||
if *flagFormat != "text" {
|
||||
color = true
|
||||
}
|
||||
|
||||
failSeverity, err := convertToScore(*flagSeverity)
|
||||
|
@ -358,7 +356,7 @@ func main() {
|
|||
}
|
||||
|
||||
// Create output report
|
||||
if err := saveOutput(*flagOutput, *flagFormat, *flagColor, flag.Args(), issues, metrics, errors); err != nil {
|
||||
if err := saveOutput(*flagOutput, *flagFormat, color, flag.Args(), issues, metrics, errors); err != nil {
|
||||
logger.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue