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 <ttabi@nvidia.com>
destdir=
num_jobs=1
+usage() {
+ echo "Usage: $0 [-v] [-jN] [--xz|--zstd] <destination directory>"
+}
+
err() {
printf "ERROR: %s\n" "$*"
+ usage
exit 1
}
shift
;;
+ -h|--help)
+ usage
+ exit 1
+ ;;
+
*)
if test -n "$destdir"; then
err "unknown command-line options: $*"