diff options
Diffstat (limited to '')
-rwxr-xr-x | aux/workflow/assert-changelog.sh | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh index 61cd916..11088a8 100755 --- a/aux/workflow/assert-changelog.sh +++ b/aux/workflow/assert-changelog.sh @@ -2,10 +2,34 @@ set -eu TLD="$(cat aux/tld.txt)" -PROJECT_UC="$1" -PROJECT="$2" -shift -shift +PROJECT_UC= +while getopts 'n:N:' flag; do + case "$flag" in + n) + PROJECT="$OPTARG" + ;; + N) + PROJECT_UC="$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' + +if [ -z "${PROJECT_UC:-}" ]; then + PROJECT_UC="$PROJECT" +fi HOMEPAGE_LINK="Changelog for [$PROJECT_UC](https://$TLD/$PROJECT/)." @@ -33,8 +57,7 @@ for VVERSION in $(git tag); do done # "$@" represents a list of tags to be also included in the verification. -# shellcheck disable=2068 -for VVERSION in $@; do +for VVERSION in "$@"; do DATE="$(date '+%Y-%m-%d')" assert "$DATE" "$VVERSION" done |