From 0c974a0cc7d0d5e25f589241fa418c5bddcc1b64 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 19 Feb 2018 15:06:41 +0100 Subject: [PATCH] Incorporate the first manpage integrity check --- doc/tools/Makefile.am | 2 ++ doc/tools/test-manpage.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 doc/tools/test-manpage.sh diff --git a/doc/tools/Makefile.am b/doc/tools/Makefile.am index bc8af488..17e4fbf1 100644 --- a/doc/tools/Makefile.am +++ b/doc/tools/Makefile.am @@ -2,6 +2,8 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in EXTRA_DIST = completion-template +TESTS = test-manpage.sh + dist_noinst_DATA = $(wildcard $(srcdir)/*.xml) if ENABLE_DOC html_DATA = tools.html diff --git a/doc/tools/test-manpage.sh b/doc/tools/test-manpage.sh new file mode 100755 index 00000000..8fdb0913 --- /dev/null +++ b/doc/tools/test-manpage.sh @@ -0,0 +1,17 @@ +#!/bin/bash +SOURCE_PATH=../../ + +# find all the manual pages in src/tools +TOOLS=`find "${SOURCE_PATH}/doc/tools" -name "*.1.xml" | sed -E -e "s|.*/([a-z0-9-]*).*|\1|"` +ALL=1 + +for T in $TOOLS; do + SWITCHES=`${SOURCE_PATH}/src/tools/${T} 2>&1 | awk '{if (match($0,"--[a-zA-Z0-9-]*",a) != 0) print a[0]} {if (match($0," -[a-zA-Z0-9]",a) != 0) print a[0]}'` + for S in $SWITCHES; do + grep -q -- "$S" ${SOURCE_PATH}/doc/tools/${T}.1.xml || { echo "${T}: missing switch $S"; ALL=0; }; + done +done +if [ "$ALL" = 0 ]; then + echo "Not all the switches in help are documented in manual pages" + exit 1; +fi