Skip to content

Commit

Permalink
build-deb.sh: Add help, handle unknown arguments
Browse files Browse the repository at this point in the history
```
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>]
```
  • Loading branch information
sjlongland committed Jul 21, 2020
1 parent 5173683 commit 2bf18df
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ while [ $# -gt 0 ] && [ "$1" != "--" ]; do
SIGN_KEY=$2
shift
;;
*)
echo "Usage: $0 [--build-source-pkg] [--skip-binary]"
echo " [{--sign-key|-l} <GPG KEY ID>"
echo " [-- <dpkg-buildpackage options>"
case "$1" in
"-h"|"-?"|--help)
exit 0
;;
*)
echo "Unrecognised argument ${1}"
exit 1
;;
esac
esac
shift
done
Expand Down

0 comments on commit 2bf18df

Please sign in to comment.