Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/catp/catp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
// skip is a slice of OR items, that are slices of AND items.
skip [][][]byte

finalPass bool

currentFile *progress.CountingReader
currentTotal int64

Expand Down Expand Up @@ -272,6 +274,7 @@

func (r *runner) shouldWrite(line []byte) bool {
shouldWrite := false
passed := false

if len(r.pass) == 0 {
shouldWrite = true
Expand All @@ -289,6 +292,7 @@

if orPassed {
shouldWrite = true
passed = true

break
}
Expand All @@ -299,6 +303,10 @@
return shouldWrite
}

if passed && r.finalPass {
return true
}

Check notice on line 308 in cmd/catp/catp/app.go

View workflow job for this annotation

GitHub Actions / test (stable)

1 statement(s) on lines 306:308 are not covered by tests.

for _, orFilter := range r.skip {
orPassed := true

Expand Down Expand Up @@ -521,6 +529,7 @@
cpuProfile := flag.String("dbg-cpu-prof", "", "write first 10 seconds of CPU profile to file")
memProfile := flag.String("dbg-mem-prof", "", "write heap profile to file after 10 seconds")
output := flag.String("output", "", "output to file (can have .gz or .zst ext for compression) instead of STDOUT")
flag.BoolVar(&r.finalPass, "final-pass", false, "don't check skip if pass was successful")
flag.BoolVar(&r.noProgress, "no-progress", false, "disable progress printing")
flag.BoolVar(&r.countLines, "l", false, "count lines")
flag.Float64Var(&r.rateLimit, "rate-limit", 0, "output rate limit lines per second")
Expand Down
Loading