From ee7c68cef40403cf654ecf4a8c55a348be28fd90 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 6 Feb 2024 12:41:51 -0800 Subject: xls: show tree(1)-style output if called as xtree Closes: #321 [via git-merge-pr] --- xls | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'xls') diff --git a/xls b/xls index 3fdd090..08bdcca 100755 --- a/xls +++ b/xls @@ -1,5 +1,17 @@ -#!/bin/sh +#!/bin/bash # xls PKGS... - list files contained in PKGS (including binpkgs) +# xtree PKGS... - list files contained in PKGS (including binpkgs) in a tree-style format + +PROG="${0##*/}" +FILTER="cat" + +if [ "$PROG" = xtree ]; then + if type tree >/dev/null; then + FILTER="tree --noreport --fflinks --fromfile ." + else + echo "$PROG: could not find tree, falling back to xls" >&2 + fi +fi BRANCH=$(git symbolic-ref -q --short HEAD 2>/dev/null) if [ -n "$XBPS_HOSTDIR" ]; then @@ -21,6 +33,7 @@ ADDREPO=" --repository=$XBPS_BINPKGS/debug " +set -o pipefail for pkg; do - xbps-query $ADDREPO -f $pkg + xbps-query $ADDREPO -f $pkg | $FILTER done -- cgit 1.4.1