Files
wget2/contrib/check_options
2018-11-17 22:06:44 +01:00

38 lines
737 B
Bash
Executable File

#!/bin/sh
# exit gracefully if not bash
if test -z "$BASH_VERSION"; then exit 0; fi
shopt -s extglob # enable pattern matching for 'case'
DOCFILE=docs/wget2.md
if [ -n "$1" ]; then
DOCFILE="$1"
fi
WGET2=src/wget2
if [ -n "$2" ]; then
WGET2="$2"
fi
err=0
# won't process these options
excludes="+(--no-quiet|--html-extension)"
for opt in `$WGET2 --help|egrep -o -- '--[a-zA-Z0-9-]+'|sort -u`; do
# skip if in $excludes
case $opt in $excludes) continue;; esac
if ! egrep -q -- " \`$opt(=|\`|\[)" $DOCFILE; then
# search for the --no- variant
noopt="--no-`echo $opt|cut -c3-`"
if ! egrep -q -- " \`$noopt\`" $DOCFILE; then
echo "Failed to find \`$opt in $DOCFILE"
err=1
fi
fi
done
exit $err