File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1717 flRun = flag .String ("run" , "" , "comma delimited list of rules to run. Defaults to all." )
1818 flVerbose = flag .Bool ("v" , false , "verbose" )
1919 flDebug = flag .Bool ("D" , false , "debug output" )
20+ flQuiet = flag .Bool ("q" , false , "less output" )
2021 flDir = flag .String ("d" , "." , "git directory to validate from" )
2122)
2223
@@ -26,6 +27,9 @@ func main() {
2627 if * flDebug {
2728 os .Setenv ("DEBUG" , "1" )
2829 }
30+ if * flQuiet {
31+ os .Setenv ("QUIET" , "1" )
32+ }
2933
3034 if * flListRules {
3135 for _ , r := range validate .RegisteredRules {
Original file line number Diff line number Diff line change @@ -70,10 +70,18 @@ func (r *Runner) Run() error {
7070
7171 // run them and show results
7272 for _ , commit := range c {
73- fmt .Printf (" * %s %q ... " , commit ["abbreviated_commit" ], commit ["subject" ])
73+ if os .Getenv ("QUIET" ) == "" {
74+ fmt .Printf (" * %s %q ... " , commit ["abbreviated_commit" ], commit ["subject" ])
75+ }
7476 vr := Commit (commit , r .Rules )
7577 r .Results = append (r .Results , vr ... )
76- if _ , fail := vr .PassFail (); fail == 0 {
78+ _ , fail := vr .PassFail ()
79+ if os .Getenv ("QUIET" ) != "" {
80+ // everything else in the loop is printing output.
81+ // If we're quiet, then just continue
82+ continue
83+ }
84+ if fail == 0 {
7785 fmt .Println ("PASS" )
7886 } else {
7987 fmt .Println ("FAIL" )
You can’t perform that action at this time.
0 commit comments