From e60f1b17e081b8fed4702de004fedf03e845f49e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 5 Sep 2024 15:22:58 -0400 Subject: [PATCH] Print which files and how many replacements for each file with a replacement --- bp.c | 3 +++ 1 file changed, 3 insertions(+) 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); }