From 6f6f0e9104092c745600725ecdd7da6c7e258c50 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Sun, 3 Jan 2016 18:47:25 +0100 Subject: xlocate: add progress bar and fix for newer findutils which need / first. --- xlocate | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xlocate') diff --git a/xlocate b/xlocate index 85513a8..472045f 100755 --- a/xlocate +++ b/xlocate @@ -4,9 +4,15 @@ : ${XLOCATE_DB:=~/.cache/xlocate.db} xupdatedb() { + if command -v pv >/dev/null; then + PROGRESS="pv -l" + else + PROGRESS=cat + fi echo "xlocate: reindexing database..." 1>&2 xbps-query -Ro '*' | - sed 's/ *([^)]*)$//; s|: ||;' | + $PROGRESS | + sed 's/ *([^)]*)$//; s|: ||; s,^,/,' | /usr/libexec/frcode >"$XLOCATE_DB" } @@ -26,7 +32,7 @@ if [ -e "$XLOCATE_DB" ]; then esac # XXX also matches template in package name. glocate $rx -d "$XLOCATE_DB" "$1" | - sed 's|^\([^/]*\)-[^-/]*/|\1\t/|' + sed 's|^/\([^/]*\)-[^-/]*/|\1\t/|' else xbps-query --regex -Ro "$@" | sed 's/ *([^)]*)$//; s/^\([^ ]*\)-[^-]*: /\1\t/' -- cgit 1.4.1