diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-05 15:22:58 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-05 15:22:58 -0400 |
| commit | e60f1b17e081b8fed4702de004fedf03e845f49e (patch) | |
| tree | f2ec3bdcbeb56fbfbbd3c5dfb31876e95b7534cb | |
| parent | c55fbce5b844952b13d4584798f6e6d1f397bece (diff) | |
Print which files and how many replacements for each file with a
replacement
| -rw-r--r-- | bp.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -422,6 +422,9 @@ static int process_file(const char *filename, bp_pat_t *pattern, bp_pat_t *defs) } modifying_file = NULL; backup_file = NULL; fclose(out); + if (matches > 0) + printf(getenv("NO_COLOR") ? "%s: %d replacement%s\n" : "\x1b[33;1m%s:\x1b[m %d replacement%s\n", + filename, matches, matches == 1 ? "" : "s"); } else { matches += print_matches(stdout, f, pattern, defs); } |
