1
0
Fork 0
mirror of https://github.com/vbatts/git-validation.git synced 2025-07-23 07:40:28 +00:00

main: adding a quiet flag to reduce the output

so you can test and just check return code

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-01-14 10:29:35 -05:00
parent eba7575f7e
commit 769b4028a4
2 changed files with 14 additions and 2 deletions

View file

@ -70,10 +70,18 @@ func (r *Runner) Run() error {
// run them and show results
for _, commit := range c {
fmt.Printf(" * %s %q ... ", commit["abbreviated_commit"], commit["subject"])
if os.Getenv("QUIET") == "" {
fmt.Printf(" * %s %q ... ", commit["abbreviated_commit"], commit["subject"])
}
vr := Commit(commit, r.Rules)
r.Results = append(r.Results, vr...)
if _, fail := vr.PassFail(); fail == 0 {
_, fail := vr.PassFail()
if os.Getenv("QUIET") != "" {
// everything else in the loop is printing output.
// If we're quiet, then just continue
continue
}
if fail == 0 {
fmt.Println("PASS")
} else {
fmt.Println("FAIL")