diff options
author | classabbyamp <void@placeviolette.net> | 2022-11-01 19:31:45 -0400 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-11-02 00:41:00 +0100 |
commit | 0abe6c2d8109b1c1f590ee5dd2f340d59cbdd240 (patch) | |
tree | 13ee8f408f3bf932c3661ebb1e8768c1f9787abd /xlocate | |
parent | ef34d3486758e906eeb9de52805aeccb8a68a4b7 (diff) | |
download | xtools-0abe6c2d8109b1c1f590ee5dd2f340d59cbdd240.tar.gz xtools-0abe6c2d8109b1c1f590ee5dd2f340d59cbdd240.tar.xz xtools-0abe6c2d8109b1c1f590ee5dd2f340d59cbdd240.zip |
xlocate: handle lack of column(1) gracefully
Diffstat (limited to 'xlocate')
-rwxr-xr-x | xlocate | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/xlocate b/xlocate index 90ba621..e58fee8 100755 --- a/xlocate +++ b/xlocate @@ -27,6 +27,12 @@ else PROGRESS=cat fi +if command -v column >/dev/null; then + COLUMN="column -ts: -l2" +else + COLUMN='sed s/:/\t/' +fi + xupdategit() { set -e DIR=$(mktemp -dt xlocate.XXXXXX) @@ -88,7 +94,7 @@ if [ -d "$XLOCATE_GIT" ]; then fi fi $GIT_CMD -c grep.lineNumber=false -c grep.column=false --git-dir="$XLOCATE_GIT" grep -- "$@" @ | - sed 's/^@://' | column -ts: -l2 | grep . + sed 's/^@://' | $COLUMN | grep . else echo "xlocate: database not found, please use xlocate -S." 1>&2 exit 1 |