diff Scripts/list.sh @ 721:034a2a62a9f8

vanilla: consolidate options with lint-options.sh
author David Demelier <markand@malikania.fr>
date Mon, 05 Aug 2019 13:19:31 +0200
parents aeee9eaa8221
children aa3c1de1780a
line wrap: on
line diff
--- a/Scripts/list.sh	Mon Aug 05 12:41:20 2019 +0200
+++ b/Scripts/list.sh	Mon Aug 05 13:19:31 2019 +0200
@@ -17,13 +17,34 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
+alias basename="busybox basename"
+alias echo="busybox echo"
 alias find="busybox find"
 alias grep="busybox grep"
+alias realpath="busybox realpath"
 alias sed="busybox sed"
 
 TOP=$(realpath $(dirname $0)/../)
 
-(
-	cd $TOP
-	find -mindepth 2 -maxdepth 2 -type d | grep -v '\.hg' | sed 's|^\./||'
-)
+scriptfile()
+{
+	echo $1/$(basename $1).sh
+}
+
+list()
+{(
+	if [ $# -eq 0 ]; then
+		find -mindepth 2 -maxdepth 2 -type d | grep -v '\.hg' | sed -e 's|^./||'
+	else
+		file=$(scriptfile $1)
+
+		if [ ! -f $file ]; then
+			echo "abort: invalid package specified '$1'" 1>&2
+			exit 1
+		fi
+
+		echo $1
+	fi
+)}
+
+list $@