about summary refs log tree commit diff
path: root/xlocate
diff options
context:
space:
mode:
authorMartin Tournoij <martin@arp242.net>2022-10-10 06:55:25 +0200
committerLeah Neukirchen <leah@vuxu.org>2022-10-18 00:22:12 +0200
commit5c5aa1daa36a022a404ef9fede2ca21c628e7694 (patch)
treeaa0e4aa738e43b8a14603d3a7790a40974425aae /xlocate
parent0a06dddd7c56bc97b8f55a15b911bda8221a51a6 (diff)
downloadxtools-5c5aa1daa36a022a404ef9fede2ca21c628e7694.tar.gz
xtools-5c5aa1daa36a022a404ef9fede2ca21c628e7694.tar.xz
xtools-5c5aa1daa36a022a404ef9fede2ca21c628e7694.zip
xlocate: output aligned, don't show "git grep" column
Disable the column number for "git grep" too, and pipe through column
for nicer aligned output.

Before:

	% ./xlocate /lib/libEGL
	MesaLib-devel-22.1.7_1  5:/usr/lib/libEGL_mesa.so -> /usr/lib/libEGL_mesa.so.0
	jetbrains-jdk-bin-11.0.15b2043.56_1     20:/usr/lib/jvm/jbrsdk/lib/libEGL.so
	libglvnd-1.4.0_1        5:/usr/lib/libEGL.so.1 -> /usr/lib/libEGL.so.1.1.0
	libglvnd-1.4.0_1        5:/usr/lib/libEGL.so.1.1.0
	libglvnd-devel-1.4.0_1  5:/usr/lib/libEGL.so -> /usr/lib/libEGL.so.1
	mesa-22.1.7_1   5:/usr/lib/libEGL_mesa.so.0 -> /usr/lib/libEGL_mesa.so.0.0.0
	mesa-22.1.7_1   5:/usr/lib/libEGL_mesa.so.0.0.0
	nvidia-libs-515.65.01_1 5:/usr/lib/libEGL_nvidia.so.0 -> /usr/lib/libEGL_nvidia.so.515.65.01
	nvidia-libs-515.65.01_1 5:/usr/lib/libEGL_nvidia.so.515.65.01
	nvidia390-libs-390.154_1        5:/usr/lib/libEGL_nvidia.so.0 -> /usr/lib/libEGL_nvidia.so.390.154
	nvidia390-libs-390.154_1        5:/usr/lib/libEGL_nvidia.so.390.154
	nvidia470-libs-470.141.03_1     5:/usr/lib/libEGL_nvidia.so.0 -> /usr/lib/libEGL_nvidia.so.470.141.03
	nvidia470-libs-470.141.03_1     5:/usr/lib/libEGL_nvidia.so.470.141.03

After:

	% ./xlocate /lib/libEGL
	MesaLib-devel-22.1.7_1               /usr/lib/libEGL_mesa.so -> /usr/lib/libEGL_mesa.so.0
	jetbrains-jdk-bin-11.0.15b2043.56_1  /usr/lib/jvm/jbrsdk/lib/libEGL.so
	libglvnd-1.4.0_1                     /usr/lib/libEGL.so.1 -> /usr/lib/libEGL.so.1.1.0
	libglvnd-1.4.0_1                     /usr/lib/libEGL.so.1.1.0
	libglvnd-devel-1.4.0_1               /usr/lib/libEGL.so -> /usr/lib/libEGL.so.1
	mesa-22.1.7_1                        /usr/lib/libEGL_mesa.so.0 -> /usr/lib/libEGL_mesa.so.0.0.0
	mesa-22.1.7_1                        /usr/lib/libEGL_mesa.so.0.0.0
	nvidia-libs-515.65.01_1              /usr/lib/libEGL_nvidia.so.0 -> /usr/lib/libEGL_nvidia.so.515.65.01
	nvidia-libs-515.65.01_1              /usr/lib/libEGL_nvidia.so.515.65.01
	nvidia390-libs-390.154_1             /usr/lib/libEGL_nvidia.so.0 -> /usr/lib/libEGL_nvidia.so.390.154
	nvidia390-libs-390.154_1             /usr/lib/libEGL_nvidia.so.390.154
	nvidia470-libs-470.141.03_1          /usr/lib/libEGL_nvidia.so.0 -> /usr/lib/libEGL_nvidia.so.470.141.03
	nvidia470-libs-470.141.03_1          /usr/lib/libEGL_nvidia.so.470.141.03

Co-authored-by: classabbyamp <5366828+classabbyamp@users.noreply.github.com>
Closes: #265 [via git-merge-pr]
Diffstat (limited to 'xlocate')
-rwxr-xr-xxlocate4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlocate b/xlocate
index 7294790..90ba621 100755
--- a/xlocate
+++ b/xlocate
@@ -87,8 +87,8 @@ if [ -d "$XLOCATE_GIT" ]; then
 			echo "xlocate: database outdated, please run xlocate -g." 1>&2
 		fi
 	fi
-	$GIT_CMD -c grep.lineNumber=false --git-dir="$XLOCATE_GIT" grep -- "$@" @ |
-		sed 's/^@://; s/:/\t/' | grep .
+	$GIT_CMD -c grep.lineNumber=false -c grep.column=false --git-dir="$XLOCATE_GIT" grep -- "$@" @ |
+		sed 's/^@://' | column -ts: -l2 | grep .
 else
 	echo "xlocate: database not found, please use xlocate -S." 1>&2
 	exit 1