summaryrefslogtreecommitdiff
path: root/script/trees
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-04-12 02:18:15 +0100
committerLeah Rowe <leah@libreboot.org>2025-04-12 02:18:15 +0100
commit115a66fddd3422c84e3911252dfb0c89febb9514 (patch)
tree160dc1508c4bfbb0f3bd25cb84f4a581d694f4fa /script/trees
parent3ea633cc791d56a769a58a3e8d889d9048cd8d74 (diff)
trees: unified handling of flags
this way, the error message will never be incorrect, which i had to fix in a recent patch. now, the same string is used for error messages and getopt. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/trees')
-rwxr-xr-xscript/trees6
1 files changed, 3 insertions, 3 deletions
diff --git a/script/trees b/script/trees
index ea161368..9776d6c0 100755
--- a/script/trees
+++ b/script/trees
@@ -15,15 +15,15 @@ eval "`setvars "" xarch srcdir premake gnatdir xlang mode makeargs elfdir cmd \
defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs gccver gccfull \
gnatver gnatfull gccdir cmakedir do_make badhash`"
-flags="-m/-u/-b/-c/-x/-f/-s/-l/-n/-d"
-
main()
{
+ flags="f:b:m:u:c:x:s:l:n:d:"
+
[ $# -lt 1 ] && $err "No argument provided"
[ "${1%-*}" = "$1" ] && $err \
"First argument must be a flag ($flags)"
- while getopts f:b:m:u:c:x:s:l:n:d: option; do
+ while getopts $flags option; do
[ -n "$_f" ] && $err "only one flag is permitted"
_f="$1"