aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-05 15:22:58 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-05 15:22:58 -0400
commite60f1b17e081b8fed4702de004fedf03e845f49e (patch)
treef2ec3bdcbeb56fbfbbd3c5dfb31876e95b7534cb
parentc55fbce5b844952b13d4584798f6e6d1f397bece (diff)
Print which files and how many replacements for each file with a
replacement
-rw-r--r--bp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bp.c b/bp.c
index c2fa2a0..8da3036 100644
--- a/bp.c
+++ b/bp.c
@@ -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);
}