summaryrefslogtreecommitdiff
path: root/resources/scripts/build/command
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-08-27 14:14:49 +0100
committerLeah Rowe <leah@libreboot.org>2023-08-27 14:24:20 +0100
commit9457d6be52e5f409566dabc10dd5435102b2e760 (patch)
tree175385fc7d0922e0ea0a318a90d5e7f0a4731f56 /resources/scripts/build/command
parent93d2dcad2d8b03eab613404e8c7c4209f250c70d (diff)
unified list command for all scripts
e.g. ./build boot roms list ./update blobs inject listboards ./build boot list ./build clean list also this is now possible: ./build list or maybe ./update list ^ would list directories in resources/scripts/build and resources/scripts/update respectively this script is added: resources/scripts/build/command/options call it like so, e.g. ./build command options resources/coreboot this script is now used, for list functions in other scripts. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'resources/scripts/build/command')
-rwxr-xr-xresources/scripts/build/command/options31
1 files changed, 31 insertions, 0 deletions
diff --git a/resources/scripts/build/command/options b/resources/scripts/build/command/options
new file mode 100755
index 00000000..84a9a3fb
--- /dev/null
+++ b/resources/scripts/build/command/options
@@ -0,0 +1,31 @@
+#!/usr/bin/env sh
+
+# Copyright (c) 2023 Leah Rowe <info@minifree.org>
+# SPDX-License-Identifier: MIT
+
+. "include/err.sh"
+
+items=1
+
+main()
+{
+ [ $# -gt 0 ] || \
+ err "No argument given"
+ listitems "${1}" || err "No items present under: ${1}"
+}
+
+listitems()
+{
+ [ -d "${1}" ] || \
+ err "Directory not does exist: ${1}"
+ for x in "${1}/"*; do
+ # -e used because this is for files *or* directories
+ [ -e "${x}" ] || continue
+ [ "${x##*/}" = "build.list" ] && continue
+ printf "%s\n" "${x##*/}"
+ items=0
+ done
+ return ${items}
+}
+
+main $@