diff options
Diffstat (limited to 'xq')
-rwxr-xr-x | xq | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xq b/xq index 12c857f..29a1b48 100755 --- a/xq +++ b/xq @@ -1,15 +1,23 @@ #!/bin/sh # xq PKGS... - query information about XBPS package +rmcol() { + sed 's/\x1b\[[0-9;]*[mG]//g' +} + +totop() { + sed -n 's/^'"$1"'/&/p;tk;H;:k;${x;s/\n//;p};d' +} + BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null) ADDREPO="--repository=hostdir/binpkgs/$BRANCH --repository=../hostdir/binpkgs/$BRANCH --repository=../../hostdir/binpkgs/$BRANCH" for pkg; do - xbps-query $ADDREPO -S "$pkg" | - sed -n 's/^short_desc/&/p;tk;H;:k;${x;s/\n//;p};d' | - sed -n 's/^pkgver/&/p;tk;H;:k;${x;s/\n//;p};d' + xbps-query $ADDREPO -S "$pkg" | rmcol | + totop short_desc | + totop pkgver xbps-query $ADDREPO -x "$pkg" | sed 's/^/ /;1s/^/depends:\n/' REVDEP=$(xbps-query -X "$pkg" | sed 's/^/ /' ) if [ "$REVDEP" ]; then |