From 07ffc2005a975030408cc836b19087e46fc24729 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Mon, 17 Mar 2025 13:32:15 -0500 Subject: [PATCH] copy-firmware: add usage help text Add a -h/--help command-line option to show some usage help text. Also display that usage whenever an error occurs. Signed-off-by: Timur Tabi --- copy-firmware.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/copy-firmware.sh b/copy-firmware.sh index dd4b9b6f..9a2b7156 100755 --- a/copy-firmware.sh +++ b/copy-firmware.sh @@ -11,8 +11,13 @@ compext= destdir= num_jobs=1 +usage() { + echo "Usage: $0 [-v] [-jN] [--xz|--zstd] " +} + err() { printf "ERROR: %s\n" "$*" + usage exit 1 } @@ -66,6 +71,11 @@ while test $# -gt 0; do shift ;; + -h|--help) + usage + exit 1 + ;; + *) if test -n "$destdir"; then err "unknown command-line options: $*"