There are a few rare cases where some options listed in the program's
built-in help page may not be documented for a valid reason. This patch
provides an option to the checking script to not complain about them, but:

 - the listed options must include a comment about why, to ensure that the
user thinks twice about it and because it is better for maintainability;

 - the listed option must be part of the options listed by the application
to ensure the command line invocation of the script will remain up to date.

This new option is then used for the check of the "configure" options
because for a few of them the right place to document them is in the
INSTALL file provided by Autoconf and not in our Window Maker specific doc.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 Makefile.am                         | 11 ++++++++++-
 script/check-cmdline-options-doc.sh | 23 +++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index a6221e9..5b52d1a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,6 +96,15 @@ check-local: configure-documentation
 
 configure-documentation:
        $(AM_V_CHKOPTS)$(top_srcdir)/script/check-cmdline-options-doc.sh \
-               --program "$(top_srcdir)/configure" --text-doc 
"$(top_srcdir)/INSTALL-WMAKER"
+               --program "$(top_srcdir)/configure" --text-doc 
"$(top_srcdir)/INSTALL-WMAKER" \
+               --ignore-prg 'with-PACKAGE,without-PACKAGE # only template 
names from Autoconf' \
+               --ignore-prg 
'program-prefix,program-suffix,program-transform-name # in INSTALL' \
+               --ignore-prg 
'version,quiet,srcdir,build,host,cache-file,no-create # in INSTALL' \
+               --ignore-prg 'enable-silent-rules,disable-silent-rules # should 
be in INSTALL' \
+               --ignore-prg 
'enable-dependency-tracking,disable-dependency-tracking # in INSTALL' \
+               --ignore-prg 'enable-shared,enable-static # should be in 
INSTALL' \
+               --ignore-prg 'disable-option-checking,enable-fast-install # 
should be in INSTALL' \
+               --ignore-prg 
'disable-libtool-lock,with-pic,with-gnu-ld,with-sysroot # for libtool' \
+               --ignore-prg 'with-x # no use, it would not work without X'
 
 .PHONY: configure-documentation
diff --git a/script/check-cmdline-options-doc.sh 
b/script/check-cmdline-options-doc.sh
index 76ad9f7..ff4a4be 100755
--- a/script/check-cmdline-options-doc.sh
+++ b/script/check-cmdline-options-doc.sh
@@ -51,6 +51,8 @@ print_help() {
     echo "$0: check program's list of options against its documentation"
     echo "Usage: $0 options..."
     echo "valid options are:"
+    echo "  --ignore-prg arg  : ignore option '--arg' from program's output"
+    echo "                (syntax: 'arg1,arg2,... # reason', args without 
leading '--')"
     echo "  --man-page file   : program's documentation file, in man format"
     echo "  --program name    : name of the program to run with '--help'"
     echo "  --text-doc file   : program's documentation file, in plain text 
format"
@@ -60,6 +62,16 @@ print_help() {
 # Extract command line arguments
 while [ $# -gt 0 ]; do
     case $1 in
+        --ignore-prg)
+            shift
+            echo "$1" | grep '#' > /dev/null || echo "Warning: no reason 
provided for --ignore-prg on \"$1\"" >&2
+            for arg in `echo "$1" | sed -e 's/#.*$// ; s/,/ /g' `
+            do
+                ignore_arg_program="$ignore_arg_program
+--$arg"
+            done
+          ;;
+
        --man-page)
             shift
             [ -z "$man_page$text_doc" ] || arg_error "only 1 documentation 
file can be used (option: --man-page)"
@@ -112,6 +124,17 @@ prog_options=`$prog_name --help | sed -n '/^[ \t]*-/ { 
s/^[ \t]*// ; s/^-[^-],[
 
 [ "x$prog_options" = "x" ] && arg_error "program '$prog_name --help' did not 
return any option"
 
+# We filter options that user wants us to, but we warn if the user asked to 
filter an option that is
+# not actually present, to make sure his command line invocation stays up to 
date
+for filter in $ignore_arg_program
+do
+  if echo "$prog_options" | grep "^$filter\$" > /dev/null ; then
+    prog_options=`echo "$prog_options" | grep -v "^$filter\$" `
+  else
+    echo "Warning: program's option does not contain \"$filter\", specified in 
\"--ignore-prg\""
+  fi
+done
+
 
 if [ -n "$man_page" ]; then
   # In the man page format, the options must be grouped in the section 
"OPTIONS"
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to