diff --git a/cmd/main.go b/cmd/main.go index 2b1f7cb..3edb5b8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -27,6 +27,7 @@ func main() { printMatchesFlag := flag.Bool("p", false, "Prints start and end index of each match. Can only be used with '-t' for multi-line mode.") caseInsensitiveFlag := flag.Bool("i", false, "Case-insensitive. Disregard the case of all characters.") recursiveFlag := flag.Bool("r", false, "Recursively search all files in the given directory.") + lineNumFlag := flag.Bool("n", false, "For each line with a match, print the line number. Implies -l.") matchNum := flag.Int("m", 0, "Print the match with the given index. Eg. -m 3 prints the third match.") substituteText := flag.String("s", "", "Substitute the contents of each match with the given string. Overrides -o and -v") flag.Parse() @@ -110,9 +111,6 @@ func main() { reader := bufio.NewReader(inputFile) linesRead = false for true { - if !(*lineFlag) && (!*onlyFlag) { - color.New(color.FgMagenta).Fprintf(out, "%s: ", inputFile.Name()) // The filename should be printed for every line, _except_ if we're not printing every line. This is the case with the lineFlag and onlyFlag - } if linesRead { break }