Skip to content

Commit 13ce679

Browse files
committed
external_deps: rework the help and error messages, also fix a bug
1 parent b878f1e commit 13ce679

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

external_deps/build.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ all_windows_platforms='windows-amd64-mingw windows-amd64-msvc windows-i686-mingw
14711471
all_macos_platforms='macos-amd64-default'
14721472
all_platforms="${all_linux_platforms} ${all_windows_platforms} ${all_macos_platforms}"
14731473

1474-
errorHelp() {
1474+
printHelp() {
14751475
sed -e 's/\\t/\t/g' <<-EOF
14761476
usage: $(basename "${BASH_SOURCE[0]}") [OPTION] <PLATFORM> <PACKAGE[S]...>
14771477
@@ -1530,7 +1530,8 @@ errorHelp() {
15301530
\tall\t${all_linux_arm64_default_packages}
15311531
15321532
EOF
1533-
false
1533+
1534+
exit
15341535
}
15351536

15361537
download_only='false'
@@ -1551,17 +1552,22 @@ do
15511552
require_theirs='true'
15521553
shift
15531554
;;
1554-
'--'*)
1555-
helpError
1555+
'-h'|'--help')
1556+
printHelp
1557+
;;
1558+
'-'*)
1559+
log ERROR 'Unknown option'
15561560
;;
15571561
*)
15581562
break
15591563
esac
15601564
done
15611565

15621566
# Usage
1563-
if [ "${#}" -lt "2" ]; then
1564-
errorHelp
1567+
if [ "${#}" -lt "1" ]; then
1568+
log ERROR 'Missing platform and package'
1569+
elif [ "${#}" -lt "2" ]; then
1570+
log ERROR 'Missing package'
15651571
fi
15661572

15671573
# Do not reuse self-built curl from external_deps custom PATH

0 commit comments

Comments
 (0)