From 99267518a6f2293eee7352b72e88cac1d985ecbe Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Tue, 27 Jun 2017 08:25:22 +0200 Subject: tools: checkusage can dump all command output 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 --- tools/checkusage.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tools') diff --git a/tools/checkusage.sh b/tools/checkusage.sh index 3d573a253..6cde8fbf6 100755 --- a/tools/checkusage.sh +++ b/tools/checkusage.sh @@ -14,6 +14,9 @@ fi 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". ## @@ -32,6 +35,7 @@ function exec_option { local cmdb=$1 local cmd=$2 opt=$3 + local tofile="/tmp/checkusage$opt" local alt="alt_${cmdb}${opt}" alt=${alt//-/_} @@ -44,6 +48,12 @@ function exec_option { 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=$? -- cgit v1.2.3-55-g7522