Skip to content

Commit a4d4f55

Browse files
committed
Add the -l / --files-with-matches option to greposcope
Allows to only print file names of diffoscope output that contains the pattern, so it's easier / quicker to identify which packages are affected by a specific issue
1 parent 60bce78 commit a4d4f55

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

package/greposcope

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ Download and search for 'pattern' in diffoscope outputs of every unreproducible
2222
This is useful to identify packages that are unreproducible because of a specific issue.
2323
2424
OPTIONS
25-
-h, --help Show this message
26-
-i, --ignore-case Ignore case distinctions in patterns and input data
25+
-h, --help Show this message
26+
-i, --ignore-case Ignore case distinctions in patterns and input data
27+
-l, --files-with-matches Only print the name of each file containing the pattern
2728
2829
Examples:
2930
$ ${progname} "gzip compressed data"
3031
$ ${progname} -i zipinfo
32+
$ ${progname} -l "max compression"
33+
$ ${progname} -i -l gnu_build_id
3134
EOF
3235
}
3336

@@ -38,7 +41,10 @@ while ((${#})); do
3841
exit 0
3942
;;
4043
-i|--ignore-case)
41-
extra_grep_opt="--ignore-case"
44+
extra_grep_opt+=("--ignore-case")
45+
;;
46+
-l|--files-with-matches)
47+
extra_grep_opt+=("--files-with-matches")
4248
;;
4349
--)
4450
shift
@@ -89,4 +95,4 @@ fi
8995

9096
echo -e "\n==> Searching for \"${pattern}\" in diffoscope outputs...\n"
9197
parallel --silent -j "$(nproc)" \
92-
"grep --color=always --with-filename --line-number ${extra_grep_opt} '${pattern}' {}" ::: "${tmp_dir}"/*.diffoscope || true
98+
"grep --color=always --with-filename --line-number ${extra_grep_opt[@]} '${pattern}' {}" ::: "${tmp_dir}"/*.diffoscope || true

0 commit comments

Comments
 (0)