ref: 8924264753ebd47da9ef1dcc1d38c2647916e36e
parent: 9f1cf1c4edd4a5de17b15905b0c09a65df32d365
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Feb 4 19:40:45 EST 2022
g: show all file names when grepping When grep gets a single file argument, it does not show the file name. This makes seeing the file name in the output of 'g' difficult. Pass a spare /dev/null to each invocation of g, in order to force it to show the file name.
--- a/rc/bin/g
+++ b/rc/bin/g
@@ -23,6 +23,7 @@
suffixes='\.([bcChlmsy]|asm|awk|cc|cgi|cpp|cs|go|goc|hs|java|lua|lx|mk|ml|mli|ms|myr|pl|py|rc|sh|tex|xy)$'
fullnames='(^|/)mkfile$'
+repodirs='(^|/)(.git|.hg)($|/)'
switch($#*){
case 0
walk -f $recurse | grep -e $fullnames -e $suffixes >[2]/dev/null
@@ -34,4 +35,4 @@
if not
echo $f
}
-} | xargs grep -n $flags -- $pattern
+} | grep -v $repodirs | xargs grep -n $flags -- $pattern /dev/null
--
⑨