diff options
author | John Ankarström <john@ankarstrom.se> | 2020-11-20 15:47:10 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2020-11-20 15:47:10 +0100 |
commit | 428d6e34e529046e0272db77908114e1b1809202 (patch) | |
tree | 9f18a20d4248e7fa103062d89a1f1079da2c3d8b | |
parent | fb40bc617913ab7b357f4acd30e58dad399d366e (diff) | |
download | alpine-428d6e34e529046e0272db77908114e1b1809202.tar.gz |
Truncate apk-file output in tty
-rwxr-xr-x | apk-file | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 ' /<td>/ { print } /<td class="(arch|repo)">/ { getline; getline; print } ' | sed 's/^ *//; s/<[^>]*>//g; s,/,/,g' | paste - - - - - | -grep "${2:-x86}\$" +column -to ' ' | +{ test -t 1 && cut -c -$COLUMNS || cat; } |