Skip to content

Commit

Permalink
add soft-fail flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenchie committed Mar 16, 2020
1 parent dc84aa8 commit 874a9be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/tfsec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import (
var showVersion = false
var disableColours = false
var format string
var softFail = false

func init() {
rootCmd.Flags().BoolVar(&disableColours, "no-colour", disableColours, "Disable coloured output")
rootCmd.Flags().BoolVar(&disableColours, "no-color", disableColours, "Disable colored output (American style!)")
rootCmd.Flags().BoolVarP(&showVersion, "version", "v", showVersion, "Show version information and exit")
rootCmd.Flags().StringVarP(&format, "format", "f", format, "Select output format: default, json, csv, checkstyle")
rootCmd.Flags().BoolVarP(&softFail, "soft-fail", "s", softFail, "'Runs checks but suppresses error code")
}

func main() {
Expand Down Expand Up @@ -81,7 +83,7 @@ var rootCmd = &cobra.Command{
os.Exit(1)
}

if len(results) == 0 {
if len(results) == 0 || softFail {
os.Exit(0)
}

Expand Down

0 comments on commit 874a9be

Please sign in to comment.