From 01e525bfd4012ed7b003da7430c98495384c4363 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 15 Nov 2023 09:35:34 +0100 Subject: [PATCH] data/make_man.sh: check output of binary Since the manual page is partially generated using uv/hd-rum-transcode output (for options), check if there is some output available. Most importantly this should catch the situation when UG/reflector output changes so that it is no more extracted to the manual page. --- data/make_man.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/data/make_man.sh b/data/make_man.sh index 906036071..13d4ca8b5 100755 --- a/data/make_man.sh +++ b/data/make_man.sh @@ -38,6 +38,16 @@ run_asciidoc() { "$exe" $opt manpage $VERBOSE "$1" } +check_append_rm() { + if [ ! -s "$1" ]; then + echo "Could not obtain data from UG/reflector output!" >&2 + rm "$1" + exit 3 + fi + cat "$1" >> "$2" + rm "$1" +} + uv_man() { ASCIIDOC=uv.1.txt @@ -54,7 +64,9 @@ uv_man() { == OPTIONS == EOF - "${UV_PATH}uv" --fullhelp | sed '0,/Options:/d' >> $ASCIIDOC + tmpfile=$(mktemp) + "${UV_PATH}uv" --fullhelp | sed '0,/Options:/d' > "$tmpfile" + check_append_rm "$tmpfile" $ASCIIDOC bugreport_and_resources >> $ASCIIDOC cat <<-'EOF' >> $ASCIIDOC @@ -96,12 +108,16 @@ hd_rum_transcode_man() { == OPTIONS == EOF + tmpfile=$(mktemp) "${UV_PATH}hd-rum-transcode" -h | - awk '/where/{flag=1; next} flag{print}' | sed '/Please/,$d' >> $ASCIIDOC + awk '/where/{flag=1; next} flag{print}' | sed '/Please/,$d' > "$tmpfile" + check_append_rm "$tmpfile" $ASCIIDOC printf '\n== NOTES ==\n' >> $ASCIIDOC + tmpfile=$(mktemp) "${UV_PATH}hd-rum-transcode" -h | outdent_output | escape_apostrophe | - sed -n '/Please/,$p' >> $ASCIIDOC + sed -n '/Please/,$p' > "$tmpfile" + check_append_rm "$tmpfile" $ASCIIDOC # below heredoc contains contiunation of NOTES section cat <<-'EOF' >> $ASCIIDOC