use
$ make CU_DUMP=1 checkusage
for easily reviewing and comparing all output in
/tmp/checkusage--help
/tmp/checkusage--version
/tmp/checkusage--unknownopt
This was a big help when doing all my last usage cleanup.
Actually I used it to dump the original output, edited it
how I would like it, and then changed our programs to match
the wanted output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
builddir="."
cmds=$(echo $@ | tr ' ' '\n' | sort)
+# set env to dump all output to files
+test -z "$CU_DUMP" || rm -f /tmp/checkusage--{help,version,unknownopt}
+
## Set alternative options for --help, --version
## or --unknownopt. "x" means "not implemented".
##
local cmdb=$1
local cmd=$2
opt=$3
+ local tofile="/tmp/checkusage$opt"
local alt="alt_${cmdb}${opt}"
alt=${alt//-/_}
opt=$alt
fi
+ test -z "$CU_DUMP" || {
+ echo "##########################################################"
+ echo "#### $cmdb"
+ $cmd $opt
+ } >> "$tofile" 2>&1
+
out=$("$cmd" $opt 2>/dev/null)
err=$("$cmd" $opt 2>&1 >/dev/null)
ret=$?