#! /bin/sh
-# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
-# SPDX-License-Identifier: MIT-0
#
# tapdiffer - Render diff between input and checkfile as a TAP report
#
# OSD-compliant; otherwise the following SPDX tag incorporates the
# MIT No Attribution license by reference.
#
+# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
+# SPDX-License-Identifier: MIT-0
+#
# A newer version may be available at https://gitlab.com/esr/tapview
# Check your last commit dqte for this file against the commit list
# there to see if it might be a good idea to update.
#
-if [ "$1" = "-b" ]
-then
- diffopts=-ub
- shift
-else
- diffopts=-u
-fi
+diffopts=-u
+while getopts bn opt
+do
+ case $opt in
+ b) diffopts=-ub;;
+ *) echo "tapdiffer: unknown option ${opt}."; exit 1;;
+ esac
+done
+# shellcheck disable=SC2004
+shift $(($OPTIND - 1))
legend=$1
checkfile=$2
then
echo "ok - ${legend}"
else
- echo "not ok - ${checkfile}: ${legend}"
+ echo "not ok - ${legend}"
if [ ! "${QUIET}" = 1 ]
then
echo " --- |"