diff options
author | EuAndreh <eu@euandre.org> | 2021-06-26 18:53:51 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-06-26 21:07:44 -0300 |
commit | abd299083bc25b3e2f6e574b6840ee90bdea43ec (patch) | |
tree | fc60a61ef6377955f9a875b226b38e029bcff881 /aux/workflow | |
parent | aux/workflow/assert-spelling.sh: Define assert_arg anyway (diff) | |
download | git-permalink-abd299083bc25b3e2f6e574b6840ee90bdea43ec.tar.gz git-permalink-abd299083bc25b3e2f6e574b6840ee90bdea43ec.tar.xz |
aux/workflow/assert-readme.sh: Use getopts for arguments
Diffstat (limited to 'aux/workflow')
-rwxr-xr-x | aux/workflow/assert-readme.sh | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh index 2a6c3fd..f8a05a4 100755 --- a/aux/workflow/assert-readme.sh +++ b/aux/workflow/assert-readme.sh @@ -1,11 +1,31 @@ #!/bin/sh set -eu -PROJECT="$1" -MAILING_LIST="$2" -shift -shift TLD="$(cat aux/tld.txt)" +while getopts 'n:m:' flag; do + case "$flag" in + n) + PROJECT="$OPTARG" + ;; + m) + MAILING_LIST="$OPTARG" + ;; + *) + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + echo "Missing $2" >&2 + exit 2 + fi +} + +assert_arg "${PROJECT:-}" '-n PROJECT' +assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' EXPECTED="$(mktemp)" cat <<EOF >> "$EXPECTED" |