Skip to content

Commit b52345c

Browse files
committed
external_deps: rework the help and error messages, also fix a bug
1 parent 27e532e commit b52345c

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

external_deps/build.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,14 @@ printHelp() {
15311531
all ${all_linux_arm64_default_packages}
15321532
15331533
EOF
1534-
false
1534+
1535+
exit
1536+
}
1537+
1538+
syntaxError() {
1539+
log ERROR "${1}" || true
1540+
echo >&2
1541+
printHelp
15351542
}
15361543

15371544
download_only='false'
@@ -1552,17 +1559,24 @@ do
15521559
require_theirs='true'
15531560
shift
15541561
;;
1555-
'--'*)
1556-
helpError
1562+
'-h'|'--help')
1563+
printHelp
1564+
;;
1565+
'-'*)
1566+
syntaxError 'Unknown option'
15571567
;;
15581568
*)
15591569
break
15601570
esac
15611571
done
15621572

15631573
# Usage
1564-
if [ "${#}" -lt "2" ]; then
1565-
errorHelp
1574+
if [ "${#}" -lt "1" ]
1575+
then
1576+
syntaxError 'Missing platform and package(s)'
1577+
elif [ "${#}" -lt "2" ]
1578+
then
1579+
syntaxError 'Missing package(s)'
15661580
fi
15671581

15681582
# Do not reuse self-built curl from external_deps custom PATH
@@ -1603,7 +1617,7 @@ case "${platform}" in
16031617
done
16041618
if [ -z "${platform_list}" ]
16051619
then
1606-
errorHelp
1620+
syntaxError 'Unknown platform'
16071621
fi
16081622
;;
16091623
esac

0 commit comments

Comments
 (0)