From e1375f237c42345b9c22caeb885d6b44e14699ff Mon Sep 17 00:00:00 2001 From: Albert S Date: Tue, 27 Sep 2022 17:01:20 +0200 Subject: [PATCH] Consider return code when checking if command was already printed --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 1c3fb5e..25b00ee 100644 --- a/main.go +++ b/main.go @@ -411,6 +411,7 @@ func main() { results := search(conn, opts) previousCmd := "" + previousReturn := -1 fi, err := os.Stdout.Stat() if err != nil { @@ -428,7 +429,7 @@ func main() { if !ok { log.Panic("Failed to retrieve entries") } - if !distinct || previousCmd != entry.cmd { + if !distinct || !(previousCmd == entry.cmd && previousReturn == entry.retval) { prefix := "" postfix := "" if printColors && entry.retval != 0 { @@ -438,6 +439,7 @@ func main() { fmt.Printf("%s%s%s\n", prefix, entry.cmd, postfix) } previousCmd = entry.cmd + previousReturn = entry.retval } if cmd == "delete" {