bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68666: warning if --exclude-dir arg contains /?


From: Paul Eggert
Subject: bug#68666: warning if --exclude-dir arg contains /?
Date: Mon, 22 Jan 2024 21:37:26 -0800
User-agent: Mozilla Thunderbird

On 2024-01-22 15:48, Karl Berry wrote:
Would it be crazy for  grep --exclude-dir=foo/bar  to give a warning?

Since, as I understand it, any non-trailing / in the arg can never match
since the arg is matched against the basename.

That's not quite true, as it can match command-line arguments. For example:

  $ grep -rl . lib/* | grep '^lib/unictype/\.gitignore$'
  lib/unictype/.gitignore
$ grep --exclude-dir=lib/unictype -rl . lib/* | grep '^lib/unictype/\.gitignore$'
  $

It should be possible to give useful warnings in some cases, though.

It's too bad the rules are so complicated - that's partly my fault, as the various options were added at different times and I didn't think things through as suggestions were made. Probably too late to change the meaning of existing options now, though.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]