Skip to content

Commit

Permalink
Add skip option for the summary separator
Browse files Browse the repository at this point in the history
  • Loading branch information
technicalpickles committed Nov 2, 2023
1 parent 91caa53 commit 01a5fb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/lefthook/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,13 @@ func printSummary(
return
}

log.Separate(
log.Cyan("summary: ") + log.Gray(fmt.Sprintf("(done in %.2f seconds)", duration.Seconds())),
)
if logSettings.SkipSummarySeparator() {
log.Info(log.Cyan("summary: ") + log.Gray(fmt.Sprintf("(done in %.2f seconds)", duration.Seconds())))
} else {
log.Separate(
log.Cyan("summary: ") + log.Gray(fmt.Sprintf("(done in %.2f seconds)", duration.Seconds())),
)
}

if !logSettings.SkipSuccess() {
for _, result := range results {
Expand Down
7 changes: 7 additions & 0 deletions internal/log/skip_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const (
skipExecutionOutput
skipExecutionInfo
skipEmptySummary
skipSummarySeparator
)

type SkipSettings int16
Expand All @@ -34,6 +35,8 @@ func (s *SkipSettings) ApplySetting(setting string) {
*s |= skipExecutionInfo
case "empty_summary":
*s |= skipEmptySummary
case "summary_separator":
*s |= skipSummarySeparator
}
}

Expand Down Expand Up @@ -73,6 +76,10 @@ func (s SkipSettings) SkipEmptySummary() bool {
return s.doSkip(skipEmptySummary)
}

func (s SkipSettings) SkipSummarySeparator() bool {
return s.doSkip(skipSummarySeparator)
}

func (s SkipSettings) doSkip(option int16) bool {
return int16(s)&option != 0
}

0 comments on commit 01a5fb0

Please sign in to comment.