-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Summary
The grep builtin is missing the -L / --files-without-match flag, which prints names of files that do NOT contain any matches. This is the inverse of the existing -l flag.
Why we need this
- GNU grep compatibility:
-Lis a standard GNU grep flag used in everyday shell scripts and CI pipelines (e.g.,grep -rL 'TODO' src/to find files without TODOs). - LLM tool usage: Coding agents frequently use
grep -rLto find files that are missing expected content (missing license headers, missing imports, missing config entries). Without-L, agents must work around it withgrep -rl | commor other multi-step alternatives. - Trivial to implement: We already have
-l(files with matches).-Lis the exact inverse — print the filename whenmatch_count == 0instead of> 0.
Current state
The grep builtin (crates/bashkit/src/builtins/grep.rs) supports 27+ flags including -l, -r, -A/-B/-C, --include, --exclude, etc. -L is one of the few standard flags still missing.
Implementation notes
- Add
files_without_matches: booltoGrepOptions - Parse
-Lalongside-l - In the output phase: if
files_without_matches && !file_matched, print filename - Add tests for stdin and multi-file cases
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels