From 428d6e34e529046e0272db77908114e1b1809202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 20 Nov 2020 15:47:10 +0100 Subject: Truncate apk-file output in tty --- apk-file | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apk-file') diff --git a/apk-file b/apk-file index 912d86a..f5abc5f 100755 --- a/apk-file +++ b/apk-file @@ -2,11 +2,14 @@ # Search packages by contents -curl -s "https://pkgs.alpinelinux.org/contents?file=$1" | +COLUMNS=`resize | cut -d\; -f1 | cut -d= -f2` + +curl -s "https://pkgs.alpinelinux.org/contents?file=$1&arch=${2:-x86}" | awk ' // { print } // { getline; getline; print } ' | sed 's/^ *//; s/<[^>]*>//g; s,/,/,g' | paste - - - - - | -grep "${2:-x86}\$" +column -to ' ' | +{ test -t 1 && cut -c -$COLUMNS || cat; } -- cgit v1.2.3