Skip to contentSkip to conversation

scripts/check-config.sh: Add usage()

PATCH New Andy Shevchenko 3 participants 3 messages Dec 11, 2018 – Dec 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/check-config.sh: Add usage()

When arguments are not supplied the error message is misleading and doesn't tell what exactly has to be done.

Fix this by adding usage() and call it if above circumstance occurs.

---
 scripts/check-config.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/check-config.sh +9 -0
index 4848ca6e25..583f7d0963 100755
@@ -17,6 +17,15 @@
 set -e
 set -u
 
+PROG_NAME="${0##*/}"
+
+usage() {
+	echo "$PROG_NAME <path to u-boot.cfg> <path to whitelist file> <source dir>"
+	exit 1
+}
+
+[ $# -ge 3 ] || usage
+
 path="$1"
 whitelist="$2"
 srctree="$3"
Signature · 1 line
2.19.2
#1 lore raw

PATCH 1/1 scripts/check-config.sh: Add usage()

Quoted 10 lines · Andy Shevchenko

When arguments are not supplied the error message is misleading and doesn't tell what exactly has to be done.

Fix this by adding usage() and call it if above circumstance occurs.

---
 scripts/check-config.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
#2 lore raw

PATCH 1/1 scripts/check-config.sh: Add usage()

In reply to Andy Shevchenko
Quoted 7 lines · Andy Shevchenko

When arguments are not supplied the error message is misleading and doesn't tell what exactly has to be done.

Fix this by adding usage() and call it if above circumstance occurs.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181227/9bc42a78/attachment.sig>