Handle case where no match was found

This commit is contained in:
Chigozirim Igweamaka 2024-07-09 23:10:50 +01:00
parent b3b46cf21b
commit 783c81ae0f

View file

@ -49,6 +49,12 @@ func find(filePath string) {
return
}
if len(matches) == 0 {
fmt.Println("\nNo match found.")
fmt.Printf("\nSearch took: %s\n", searchDuration)
return
}
msg := "Matches:"
topMatches := matches
if len(matches) >= 20 {