1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

build: Add doctest make target

Running `make doctest` will make sure the manual page is synchronized with the
available options.
This commit is contained in:
Olof Johansson 2015-03-22 18:00:25 +01:00
parent 7cde2ca8e7
commit 47b05a245d
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
all: svtplay-dl all: svtplay-dl
.PHONY: test cover pylint svtplay-dl .PHONY: test cover doctest pylint svtplay-dl
VERSION = 0.10.$(shell date +%Y.%m.%d) VERSION = 0.10.$(shell date +%Y.%m.%d)
@ -53,6 +53,9 @@ cover:
pylint: pylint:
$(MAKE) -C lib pylint $(MAKE) -C lib pylint
doctest: svtplay-dl
sh scripts/diff_man_help.sh
clean: clean:
$(MAKE) -C lib clean $(MAKE) -C lib clean
rm -f svtplay-dl rm -f svtplay-dl

View File

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
# Make sure the options listed in --help and the manual are in sync. # Make sure the options listed in --help and the manual are in sync.
diff_opts="$@"
diff_opts=${diff_opts:-"-u"}
TMPDIR=$(mktemp -d svtplay-man-test-XXXXXX) TMPDIR=$(mktemp -d svtplay-man-test-XXXXXX)
[ "$TMPDIR" ] || { [ "$TMPDIR" ] || {
echo "mktemp not available, using static dir" echo "mktemp not available, using static dir"
@ -35,6 +33,7 @@ for file in $TMPDIR/options.*; do
perl -i -pe 's/^(-.(?: [^-][^ ]+)?) (--.*)/\2 \1/' $file perl -i -pe 's/^(-.(?: [^-][^ ]+)?) (--.*)/\2 \1/' $file
done done
# There should be no difference. [ "$(sha1sum<$TMPDIR/options.help)" = "$(sha1sum<$TMPDIR/options.man)" ] || {
diff $diff_opts $TMPDIR/options.* diff -u $TMPDIR/options.help $TMPDIR/options.man
#sha1sum $TMPDIR/options.* exit 1
}