Skip to content

Commit 2bf18df

Browse files
committed
build-deb.sh: Add help, handle unknown arguments
``` RC=0 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh --foo --bar -mokey 7 --skip-binary --hello -- Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary] [{--sign-key|-l} <GPG KEY ID>] [-- <dpkg-buildpackage options>] Unrecognised argument --foo RC=1 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh -h Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary] [{--sign-key|-l} <GPG KEY ID>] [-- <dpkg-buildpackage options>] RC=0 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh -? Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary] [{--sign-key|-l} <GPG KEY ID>] [-- <dpkg-buildpackage options>] RC=0 stuartl@rikishi ~/vrt/projects/metermaster/libs/libmbus $ ./build-deb.sh --help Usage: ./build-deb.sh [--build-source-pkg] [--skip-binary] [{--sign-key|-l} <GPG KEY ID>] [-- <dpkg-buildpackage options>] ```
1 parent 5173683 commit 2bf18df

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

build-deb.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ while [ $# -gt 0 ] && [ "$1" != "--" ]; do
2525
SIGN_KEY=$2
2626
shift
2727
;;
28+
*)
29+
echo "Usage: $0 [--build-source-pkg] [--skip-binary]"
30+
echo " [{--sign-key|-l} <GPG KEY ID>"
31+
echo " [-- <dpkg-buildpackage options>"
32+
case "$1" in
33+
"-h"|"-?"|--help)
34+
exit 0
35+
;;
36+
*)
37+
echo "Unrecognised argument ${1}"
38+
exit 1
39+
;;
40+
esac
2841
esac
2942
shift
3043
done

0 commit comments

Comments
 (0)